# Time calculator project in Python

OK… Here I am… As the comedian Dane Cook says in his comedy show: “I did my best ” (Crying–Dane Cook)[Dane Cook - Crying - YouTube]

Watching the Dane Cook skit before reading further might make you smile before seeing the question. Is a good show… But let’s ask the question…

Here’s my REPL:

This is the output of my tests:

5:42 PM
5:42 PM expected

3:07 PM
3:07 PM expected

2:45 AM (next day)
2:45 AM (next day) expected

12:05 PM
12:05 PM expected

2:59 AM (next day)
2:59 AM (next day) expected

12:04 AM (2 days later)
12:04 AM (2 days later) expected

6:18 AM (20 days later)
6:18 AM (20 days later) expected

5:1 AM
5:01 AM expected

5:42 PM, Monday
5:42 PM, Monday expected

2:59 AM, Sunday (next day)
2:59 AM, Sunday (next day) expected

12:04 AM, Friday (2 days later)
12:04 AM, Friday (2 days later) expected

6:18 AM, None (20 days later)
6:18 AM, Monday (20 days later) expected

I did my best!

I am working on why am I getting those two mistakes. Also, why is it that my REPL says that there are six mistakes?

I just caught one of the mistakes in the following block of code:

``````def key_day_calc(total_day):
while total_day >= 7:
total_day = key_day_calc(total_day - 7)
``````

It was missing the equal sign in the `total_day` variable.

Another fix:

``````    if reg_new_time[1] >= 1 and reg_new_time[1] <= 9:
reg_new_time[1] = f"0{reg_new_time[1]}"
``````

I was missing the equal signs in that conditional…

This is now the output:

5:42 PM
5:42 PM expected

3:07 PM
3:07 PM expected

2:45 AM (next day)
2:45 AM (next day) expected

12:05 PM
12:05 PM expected

2:59 AM (next day)
2:59 AM (next day) expected

12:04 AM (2 days later)
12:04 AM (2 days later) expected

6:18 AM (20 days later)
6:18 AM (20 days later) expected

5:01 AM
5:01 AM expected

5:42 PM, Monday
5:42 PM, Monday expected

2:59 AM, Sunday (next day)
2:59 AM, Sunday (next day) expected

12:04 AM, Friday (2 days later)
12:04 AM, Friday (2 days later) expected

6:18 AM, Monday (20 days later)
6:18 AM, Monday (20 days later) expected

Many thanks @camperextraordinaire , I believe that I can fix that.

At last… Had it not been for @camperextraordinaire I’d be still chasing my tail…

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