34.1k views
2 votes
Write an application that reads values representing a time duration in hours, minutes, and seconds and then prints the equivalent total number of seconds. (For example, 1 hour, 28 minutes, and 42 seconds is equivalent to 5322 seconds.)

1 Answer

4 votes

Answer:

Step-by-step explanation:

def cvtToSeconds(hours,minutes,seconds):

total_seconds=3600*hours+60*minutes+seconds;

return total_seconds

def readData():

hours = eval(input("Enter Hours: "))

minutes = eval(input("Enter Minutes: "))

seconds = eval(input("Enter Seconds: "))

total_seconds=cvtToSeconds(hours,minutes,seconds)

print("Total Seconds: "+str(total_seconds))

readData()

Write an application that reads values representing a time duration in hours, minutes-example-1
User Jpolete
by
3.7k points