Skip to content
Advertisement

Python: class and object

I have no idea why when i run my code it returns wrong value.

JavaScript

These are the assertions that I use to test my code

JavaScript

when i print out my code i get a correct result for weeks and hours, buts for days I always get the wrong result. If anybody know could youplease help me.

Advertisement

Answer

I couldn’t figure out what your logic is when reading your code, so I rewrote some of the logic while still keeping the overall structure the same:

JavaScript

But something like this can be written in much simpler code using divmod, try to see if you can figure it out.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement