# Takes time as input and writes if it is morning, # afternoon or evening hours. # Read the input value time = float( input('Give present time: ') ) # Check the time slot in which input values lies # This is done by using if statements. if ( time > 0 ) and ( time <= 12 ) : print('Morning hours') else: if ( time > 12 ) and ( time <= 18 ) : print ('Afternoon hours') else: if ( time > 18 ) : print('Evening hours')