-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime2.py
More file actions
23 lines (23 loc) · 711 Bytes
/
time2.py
File metadata and controls
23 lines (23 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import time
# def hour(int):
# if (hour < 12):
# print ('Good Morning')
# if (hour >= 12 and hour <17 ):
# print('Good Afternoon')
# if (hour >=17):
# print('Good Evening')
# t= int(time.strftime('%H'))
# # print(f"hello and {t.hour}")
# print(hour(t))
# import datetime
# hour = datetime.datetime.now().hour
# greeting = "Good morning" if 5<=hour<12 else "Good afternoon" if hour<18 else "Good evening"
# print(f"hello and {greeting}")
hour= int(time.strftime('%H'))
if (hour < 12):
greeting = 'good morning'
if (hour >= 12 and hour <17 ):
greeting = 'good afternoon'
if (hour >=17):
greeting = 'good evening'
print(f"hello and {greeting}")