Time Calculator (Day Tests)

Hi,

I’m having difficulties with the last 3 tests involving the Day changing if the time duration resulted in a new day.

I’m using a dictionary to assign key/value to the days of week. Then I realized what happens if I’m on “7: Saturday” and I need to go back to the start “1 : Sunday”. Right now I’m just trying to solve the test for 24 hour duration.

I was trying to do something like this:

Line 48

elif ((elapsedhour == 24) and (elapsedmin == 0) and (min < 10)):
              week["day"] = week.get(day, 0) + 1
              new_time = "{}:0{} {}, {} (next day)".format(hour, min, period, day.capitalize())

Is a dictionary the right way to go?

Thank you.

Well you check if your number is bigger than 7 and if so, go back to 1 :wink:

For mapping numbers to strings? Sure.
Though I don’t really understand what the code-snippet is doing, so you gotta figure out the implementation yourself.

1 Like

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