Time Calculator - HELP need some guidance/direction/tips please!

What is the best approach to handle the ‘n-days’…

I’ve tried and getting some type of output, but getting mixed up somewhere…
and currently I’m only working on AM…

I can get the (9 days later), having issues showing (next day) instead I’m getting (1 days later).

Also need to figure out how to handle ‘day’ ==> (“11:43 PM”, “24:20”, “tueSday”)

Any ideas welcome and highly appreciated…

Thanks all

The way I would go about it is i would use a 24 hour format. So first i would convert the given time to the 24 hour format. Then I would add the time that should pass. Then you can use the modulo operator %and divide by 24 to get the new time. you can use the // operator to get how many days have passed. Then just use an if statment before printing,
if daysPassed = 1, print next day.

To work out what day it is at the moment, you can create a list with the days of the week in it. use list.index() to get the day of the week it is right now. Then add the daysPassed to the index and do the modulus %. then before printing calculate whether it should be am or pm.

hope this helps.

Hello SupremeSadat, I will try your approach using modulo operator…

Thank you appreciate it.


the // operator is very useful.

7//3 = 2
9//2 =4
9%2= 1 
% gets remainder.
// whole number(interger) division