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.
Yeah. It passed all the tests, therefore it's incorrect. Solid logic.
This is incorrect.
but its not supposed to go above 24 hours right?
that looks more efficient compared to how i did it XD
Why is all red on this solution?
You are not wrong, but maybe data can be validated with another function, for example one that checks in first place if h, m and s are numbers (float or integers), then another function to check if they are content in a specific range.
But as long as you are not being told to specifically do the data validation, just doing the maths is fine for this function. The input constraints can be understand as a condition already satisfied.
https://peps.python.org/pep-0008/
I don't understand your point.
I'm not sure. I think it depends of the context of the function and that is something to not worry about at this stage.
If I get picky, there is no documentation or function contract. When I read the given definition of the function, it must do only the maths behind the conversion. It doesn't say that it should validate data, what if I use as input (O, !, 1)?
The sepecifications of the input constraints makes me interpret them as the function's preconditions. Maybe a special function that validates what a day, hour and minute should look like is in charge of that and that would be a better practice too, isn't it?.
I agree with others who are of the opinion that this particular solution cannot be labeled "best practice". The instructions include a limit of <=23 which is not applied in this solution.
In my own projects, I will do this. Codewars though, I just like making an effort to try putting everything in 1 line of code. especially with python, theres been many instances of this lol.
It will not work for sum of hours, munites and seconds more then 24hours.
It isn't best practice to use magic numbers. I know it's fairly obvious what the numbers mean, but it's a bad habit to get into.
Maybe you could first validate that the inputs are within a valid range.
Nice job! :D
Loading more items...