Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
That's part of the solution, why would the description show it?
.
Then how can I show that it is an integer division?
lol
//
is an inline comment in C#...Changed the first one to
15000km (allowedKmsPerYear) // ( 365 days or 366 days if its a leap year ) = 41km
This change does not address the original issue in any way.
Changed to
(3316km (currentKms) / 2173km (allowedKmsToTargetDate)) * 100 = 152.60% (return value)
Okay, it is fixed too!
I just saw that the allowedKmsPerDay is an integer in C#.
And that's what makes the difference.
Now the sample tests and final tests are the same in both languages.
The only difference is, first final test returns 100 in C# but it is 100.01 in Python.
I don't know if it's a problem.
Thanks again!
Thanks Sir, I changed the solution.
Now it accounts the leap year, but I have a question about the answers.
In C#,
Codewars.LimitExceeded(new DateTime(2017, 4, 23),new DateTime(2017, 10, 23), 15000, 10777) returns 143.64
But in Python,
limit_exceeded(date(2017, 4, 23), date(2017, 10, 23), 15000, 10777) returns 143.30
Every test is like this, there are small differences between the answers and i don't know why. Do you have any ideas on this?
But I don't think the reference solution in Python does so.
Also check the C# reference solution, and try to find how division is done there, so you can adapt the Python reference solution accordingly.
Oops. I'll try to fix it, sorry.
More specifically, Python does not take into account the leap year and there are some discrepancies concerning integer and float division.
Fixed.
Fixed.
Loading more items...