Posts

Showing posts with the label time module

Greetings Program in Python

Just enter your name and the program will greet you according to the time of the day. Note: If you run this program on your computer, it will respond according to your system time. In case you run this program on any online platform, it may respond according to the server time on which that platform is hosted. import time name = input("Plz enter your name: ") # timeNow = time.strftime("%H:%M:%S") # print(timeNow) hr = int(time.strftime("%H")) # print(hr) mints = int(time.strftime("%M")) # print(mints) secs = int(time.strftime("%S")) # print(secs) if hr in range(6, 12): if mints in range(0, 60): if secs in range(0, 60): print("Good Morning", name) elif hr in range(12, 14): if mints in range(0, 60): if secs in range(0, 60): print("Good Noon", name) elif hr in range(14, 17): if mints in range(0, 60): if secs in range(0, 60): ...