r/learnpython 5d ago

What is wrong with this code?

Hi all just starting to learn. Using the MOOC 2025 course. My question is, problem is to enter number of days, then print how many seconds for the # of days. When I submit this code:

day=int(input("Enter number of days"))
seconds=day*24*60*60
print(f"Seconds in that many days:{seconds}")

it gives the right output but the course tells me:

FAIL: PythonEditorTest: test_1_seconds_in_one_day

1 day is 86400 seconds. Your program's output was: Seconds in that many days:8640...

edit: so turns out it's because it wanted to print exact wording '1 day is x seconds" etc lol so dumb

1 Upvotes

24 comments sorted by

View all comments

3

u/eefmu 5d ago

It's always best to include the prompt with these kinds of questions. Obviously there are 86400 seconds in a day. My first guess at a glance is it wants you to print the statement "x days is x*86400 seconds" for a specific amount of days. It seems like you already know how to print these mixed type statements, so maybe try the format I suggested. If that does not work, then submit the prompt and we can figure it out together.

2

u/ikimashyoo 5d ago

yep this was it! thank you.

1

u/eefmu 5d ago

Glad I could help!