182k views
5 votes
The program below reads in the number of minutes entered by a user. The program that converts the number of minutes to hours and minutes. Run the program, then modify the code to work in reverse: The user enters two numbers for hours and minutes and the program outputs total minutes.

User Ktross
by
5.8k points

1 Answer

4 votes

Answer:

Written in Python:

hours = int(input("Hours: "))

mins = int(input("Minutes: "))

result = hours * 60 + mins

print("Result: "+str(result)+" minutes")

Step-by-step explanation:

This line prompts user for hours

hours = int(input("Hours: "))

This line prompts user for minutes

mins = int(input("Minutes: "))

This line calculates the required output

result = hours * 60 + mins

This line prints the required output in minutes

print("Result: "+str(result)+" minutes")

User David Casanellas
by
5.1k points