11. Write a program that reads two times in military format (0900, 1730) and prints the numbers
and minutes between the two times.
A sample run is being given below :
Please enter the first time : 0900
Please enter the second time : 1730
8 hours 30 minute
see the attachment..
Attachments:
Answers
Answered by
13
Here is a program in python 3 that uses string slicing, integer division and mod.
Hope this helps
Attachments:
dishdhauma:
thank u so much
Answered by
2
Answer:
t1=int(input("Enter first time in military format:"))
t2=int(input("Enter second time in military format:"))
if t1<=2400 and t2<=2400:
min_remaining=abs(t1-t2)
print((min_remaining//100),"hours",60-(min_remaining%100),"min")
else:
print("Invalid time")
Explanation:
Similar questions