Computer Science, asked by asiyaarif, 8 months ago

Write a python program that reads from user (i) an hour between 1 to 12 and (ii) number of hours ahead. the program should print the time after those many hours, e.g enter hours b/w 1-12: 9
how many hours ahead :4
time at that time will be :1 0' clock

Answers

Answered by suresh34411
2

Explanation:

from datetime import time

def dhms_from_seconds(seconds):

minutes, seconds = divmod(seconds, 60)

hours, minutes = divmod(minutes, 60)

days, hours = divmod(hours, 24)

return (hours, minutes, seconds)

#Specified time

time1 = datetime.strptime('01:00:00', '%H:%M:%S')

#Current time

time2 = datetime.now()

print("\n%d hours, %d minutes, %d seconds" % dhms_from_seconds(date_diff_in_seconds(date2, date1)))

print()

Hope this will help you.

If so please mark me Brainliest.

Answered by surendrasahoo
8

Hey your answer is in the given attachment

HOPE IT IS HELPFUL

#thank you#

Attachments:
Similar questions