Python project help

Hey guys, have a look at my time calculator everything is working fine other than days.
Let me know what has to be changed and what is my mistake.

Thanks in advance.

Could you provide an example of inputs and expected + actual output?

“”" add_time(“3:00 PM”, “3:10”)

Returns: 6:10 PM

add_time(“11:30 AM”, “2:32”, “Monday”)

Returns: 2:02 PM, Monday

add_time(“11:43 AM”, “00:20”)

Returns: 12:03 PM

add_time(“10:10 PM”, “3:30”)

Returns: 1:40 AM (next day)

add_time(“11:43 PM”, “24:20”, “tuesday”)

Returns: 12:03 AM, Thursday (2 days later)

add_time(“6:30 PM”, “205:12”)

Returns: 7:42 AM (9 days later) “”"

Apart from some formatting issues: I asked you to provide BOTH the expected and actual returns, so we could figure out where an error might be.

As of know, I think those look all correct? At lest the random sample I did looked fine, unless I misscalculated that in my head.

The main problem is with days calculation. The actual o/p is giving 1 day less than the expected day.
expected O/P “12:04 AM Saturday”
actual 12:04 PM, Friday.

Let me know if anything else is needed.

See, that is helpful and the example also shows that the issue is not “one day” but “-12 hours” → and indeed in your calculations for “total_hours” you don’t take am/pm into account.

I’ve to take am and pm into the account because that’s is required in the assignment.

You don’t take it into account when calculating “total hours”.
You split it up on line 4, but next time it appears is on line 21 where you just override it.

I tried making a discord bot with replit like in the video but it doesn’t work. (SyantaxError: ‘await’ outside function

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.