Answer to Question #97041 in Python for rubi

Question #97041
2.3 Code Practice: Question 3
Write a program that accepts a time as an hour and minute. Add 15 minutes to the time, and output the result.

Example 1:

Enter the hour: 8
Enter the minute: 15
It displays:

Hours: 8
Minutes: 30
Example 2:

Enter the hour: 9
Enter the minute: 46
It displays:

Hours: 10
Minutes: 1
1
Expert's answer
2019-10-21T16:35:37-0400
h = int(input("Enter the hour: "))
m = int(input("Enter the minute: "))
total = h * 60 + m + 15
h = int(total / 60)
m = total % 60
print("Hours: " + str(h))
print("Minutes: " + str(m))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS