Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

what is wrong in my code?

0 votes
asked Oct 26, 2022 by Jonathan (120 points)

def get_seconds(hours, minutes, seconds):

return 3600*hours + 60*minutes + seconds

amount_a = get_seconds(3600*2 + 60*30)

amount_b = get_seconds(60*45 + 15)

result = amount_a + amount_b

print(result)

1 Answer

0 votes
answered Oct 30, 2022 by Peter Minarik (86,040 points)

You need to pass in the arguments to get_seconds() as hours, minutes, and seconds, then your code will work:

def get_seconds(hours, minutes, seconds):
    return 3600 * hours + 60 * minutes + seconds

amount_a = get_seconds(2, 30, 0) # 2:30:00
amount_b = get_seconds(0, 45, 15) # 0:45:15
result = amount_a + amount_b

print(result)
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...