@jcant It looks like there are spacing issues in your output. Please ensure that your output matches the formatting specified in the instructions exactly.
thank you, I partly solved the problem. I stored ‘AM’ and ‘PM’ in the variable new_m and it is in the return statement but it isn’t showing in the console and I am not sure why
Keep in mind that when an if condition evaluates to True, the following elif statements will not be executed.
I assume you are trying to get '12:03 AM, Thursday (2 days later)' as the output, but it never returns AM because the second elif condition is never reached.
Try updating your if-elif structure to use separate if statements instead, so all necessary conditions are checked.
Yes, thank you. That worked to display ‘AM’ or ‘PM’, but now i have a new problem. My spacing is off when the timer goes into a new day. It returns ‘6:18 AM(20 days later’ and when i get the spacing right on this test, the other ones fail. I’ve tried searching this issue, but I am not finding anything that works.
To help you debug, you could try commenting out the more complex code.
When you get the spacing right for the first test, uncomment the next part of the code - (next day).
Work on it until the code passes for both conditions. Then repeat the process. This will avoid the pains of going from passing one test, changing code, and failing test or tests which were previously passing.
hey, i’m not sure what part of the code you are recommending to comment out because my only problem seems to be the return statements, and it won’t work if i comment those out. (I have also tried all sorts of various spacing on these return statements.) I commented out the extra_day variable, but the tests that pass those aren’t affected by that anyway so it doesn’t change anything.
They all pass except for the ones that require ‘x days later.’ for example: 'print(repr(add_time('2:59 AM', '24:00')))' gives the output, '2:59 AM(next day)'
No, i fixed AM and PM, but i can’t get the spacing right. They all pass except for the ones that require ‘x days later.’ for example: 'print(repr(add_time('2:59 AM', '24:00')))' gives the output, '2:59 AM(next day)'
the tests that don’t pass are: Calling add_time('2:59 AM', '24:00') should return '2:59 AM (next day)', etc. and Calling add_time('3:30 PM', '2:12', 'Monday') should return '5:42 PM, Monday'. The out put right now shows, '‘2:59 AM(next day)’ and if i change the spacing on this test, the others that pass right now will fail.
that’s the part i’m confused about. When it take the space away, the other tests fail. I am not sure what I am doing wrong. (also, i haven’t changed my code from the previous message)
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.