Q. Write a program that reads two times in military format and prints the number of hours and minutes between the two times .


You can understand by Watching video :-



Answer :-

first = int(input("Please Enter the first time = "))
sec = int(input ("Please Enter the second time  = " ))

a =  sec - first 

print (a // 100, "hours " , a % 100, "min")

Output :-

Please Enter the first time = 0900
Please Enter the second time  = 1730
8 hours  30 min

>>> 

Please Enter the first time = 1115
Please Enter the second time  = 2355
12 hours  40 min

>>> 

Please Enter the first time = 1214
Please Enter the second time  = 2230
10 hours  16 min

>>>


1 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post