-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
91 lines (73 loc) · 2.77 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import json
# Load the JSON data file
with open('data/hindu_temples.json', 'r') as f:
data = json.load(f)
with open('data/dieties.json', 'r') as f:
dieties_data = json.load(f)
# Function to print temple information
def print_temple_info(temple):
print("==================================================================")
print(f"### Name: {temple['name']}")
print(f"State: {temple['state']}")
print("------------------------------------------------------------------")
print(temple['info'])
print("------------------------------------------------------------------")
print(temple['story'])
print("------------------------------------------------------------------")
print(temple['visiting_guide'])
print("------------------------------------------------------------------")
print(temple['architecture'])
print("------------------------------------------------------------------")
print(temple['mention_in_scripture'])
print("==================================================================")
# Function to print all temples information
def print_all_temples_info(data):
"""Prints the information of all temples in the data dictionary."""
for name in data.keys():
temples=data[name]
for temple in temples:
print_temple_info(temple)
# Function to print temples by name
def print_temples_by_diety_name(name):
"""Prints the information of temples dedicated to a specific deity."""
if name in data:
for temple in data[name]:
print_temple_info(temple)
else:
print("Sorry, the temple you are looking for was not found.")
print('available options: {}'.format(', '.join(data.keys())))
# Function to print temple information by name
def print_temple_info_by_name(name):
"""Prints the information of a temple by its name."""
for name in data.keys():
temples=data[name]
for temple in temples:
if temple['name'].lower() == name.lower():
print_temple_info(temple)
return
print("Sorry, the temple you are looking for was not found.")
for name in data.keys():
temples=data[name]
print('available options for God \'{}\': {}'.format(
name,
', '.join([temple['name'] for temple in temples])
)
)
print("------------------------------------------------------------------")
# Main Function
def main():
# Print all temples information
print("**All Temples Information:**")
print_all_temples_info(data)
print("**All Temples FROM data/dieties.json :**")
print_all_temples_info(dieties_data)
# Print temples information by name
name = input("Enter a name to see temple information: ")
print(f"**Temples of {name}:**")
print_temples_by_diety_name(name)
# Print temple information by name
name = input("Enter a temple name to see its information: ")
print(f"**Information about {name}:**")
print_temple_info_by_name(name)
if __name__ == "__main__":
main()