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.
I had to learn how to format in Python, but just for this excersise. If you are just learning to program and happen to be using Python and not learning it specificaly, as me, this excersise looks like a 6 kyu or 5 kyu rather than a 7 kyu.
In noob: it means that minimum or maximum are a reference to a function, right?
Hi, is this more efficient than using ternary operators?
Why wouldn't you use a ternary operator?
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.
Your observation is extremely useful.
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?.