-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathai_time.py
45 lines (31 loc) · 781 Bytes
/
ai_time.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
import datetime
while (True):
city = input("Enter city: ")
current_time = datetime.datetime.now()
hour = current_time.hour
minute = current_time.minute
second = current_time.second
if city == "Boston":
hour = hour - 4
elif city == "Tokyo":
hour = hour + 9
elif city == "Chicago":
hour = hour - 5
elif city == "Seattle":
hour = hour - 7
## add more cities here
if city == "Kolkata":
hour = hour + 5
minute = minute + 30
if city == "Karachi":
hour = hour + 5
if city == "Cairo":
hour = hour + 2
if city == "Shanghai":
hour = hour + 8
elif city == "exit":
break
else:
print(city, "is not added")
city = "GMT"
print(city, str(hour) + ":" + str(minute) + ":" + str(second))