Advertisement
KodingKid

How to print different greetings based off the time of the day in Python

Apr 26th, 2021
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.12 KB | None | 0 0
  1. import datetime
  2. x = datetime.datetime.now()
  3. if x < 12:
  4.     print("Good morning!")
  5. if x > 12:
  6.     print("Good evening!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement