0% found this document useful (0 votes)
20 views1 page

Day 15 Exercise 2

The document provides a Python program that greets users based on the current time of day. It utilizes the time module to determine the hour and outputs 'Good Morning', 'Good Afternoon', or 'Good Evening' accordingly. A sample code snippet is included for reference.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

Day 15 Exercise 2

The document provides a Python program that greets users based on the current time of day. It utilizes the time module to determine the hour and outputs 'Good Morning', 'Good Afternoon', or 'Good Evening' accordingly. A sample code snippet is included for reference.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Day 15

Excersice 2: Good Morning Sir

Create a python program capable of greeting you with Good Morning, Good Afternoon
and Good Evening. Your program should use time module to get the current hour. Here
is a sample program and documentation link for you:

import time
str=input('Enter your name : ')
hours = int([Link]('%H'))
if(hours>=0 and hours<=11):
print("Hello ",[Link](),", Good Morning ")
elif(hours>=12 and hours<=17):
print("Hello ",[Link](),", Good Afternoon ")
else:
print("Hello ",[Link](),", Good Evening ")

You might also like