Skip to content
← Back to Community
how do I get this to add up?
Profile icon
MrChocolate1

Hey guys i am new to python, this is my code. but the problem is , it is not adding up, I need the output to come up as a total of seconds. like this
[I]print_seconds(1,2,3) #this input will output the following
[O] 3723

Screen Shot 2020-03-27 at 8.10.52 PM

def print_seconds(hours, minutes, seconds):
print(hours * 3600 / 1)
print(minutes * 60 / 1)
print(seconds * 1 / 1)
print_seconds(1,2,3)

Voters
Profile icon
LucyPoulton
Profile icon
ManuelOliverKin
Profile icon
MrChocolate1
Comments
hotnewtop
Profile icon
AphixDev

you have to create a variable called sum at the top.

sum = 0

Then, instead of printing the values to the screen, add them to sum. Then print sum

Profile icon
MrChocolate1

@nt998302 really appreciated, my mistake for not clarifying, this problem is from one of my course that i am taking.

Screen Shot 2020-03-27 at 1.08.38 PM

I need to create a function that prints the total amount of seconds given the hours, minutes, and seconds function parameters. sorry for the confusion. 😥

Profile icon
AphixDev

@MrChocolate1 That's good. For organization, please accept my previous answer to close this question. Good Luck!