Python Time Calculator Failed Test

Good day to Everyone,

I need some fresh pair of eye please :slight_smile:
Mine is seemingly not working.

I am passing all the unit tests except for ONE bugger.
Been spending many many hours on trying to resolve this one.

Anyone willing to please lend me an eye and go over my code.
It is the AM/PM switching test that fails.
(FAIL: test_different_period (test_module.UnitTests)

Thank you a million times!

We can’t help without some code. Best thing is to post a link to a repl (on preferably) with your question. Second best is to post your code in code blocks (use the </> button above the editor).

Oooo no cant believe forgot to post the repl link :slight_smile:

I just can not figure why the one test fails. It is with switching between am/pm but all other tests are running okay

When posting the link it removes it. Let me try again with anchor:

Log is_am where you loop to add the hours. You’ll find it’s not what you think it is. Part of the problem is here:

    is_am = ampm == "AM"

is_am is treated like a Boolean everywhere else.

Thank you - but the line:

is_am = ampm == "AM"

returns a Boolean - it is an inline statement returning true/false? The variable “ampm” is a string var which test whether it is equal to “AM” and returns true or false of not equal to “PM”.

Okay I got it all to work - thank you everyone!

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