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.
Elementary
Elementary math lol. good times.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I am not shure ho pythonic the solution is.
It is readable and performant.
Your solution includes an additional variable. That can make it more readable, but since the function does exactly one thing (calculating a grade), I dont think this adds to the readability.
The multiple return statements...hmm yes I dont like them that much but since python does not offer a clean switch case out of the box...well.
Multiple return statements are not forbidden, but I guess PEP8 somewhat discourages you to use them.
But at the same time, some examples in the style guide also contain multiple return statements.
So maybe (and I mean maybe) it is fine in this case...
I'm not sure whether or not it's pythonic, but it seems that from efficiency point of view:
From a readability standpoint I like this solution.
I thought I read that multiple
return
statements weren't pythonic. Is this not the case? See my solution as an example.I think this solution is actually easier to read. Although, I can see where multiple
return
's might get complicated quickly.Thoughts?
did not want to type "return" each time but now I realise, that typing "return" is a lot more convenient that typing "="-symbols...
We are not in 1960 and this is Python. There is no significant difference in speed on modern CPUs for this trivial task.
Use spoiler flag next time, please.
This comment is hidden because it contains spoiler information about the solution
list comprehensions are faster than lambda expressions, great...
lol, funny method, but confusing. Never thought about getting indexes this way.