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.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Looking at other solutions should use the standard python statistics module rather than DIY.
Have included the tests I used to develop and check each functionality. These would normally be separate. The given tests are for a function that would be best separated out into different parts. Anyway that is my take on this.
Happy with this solution.
This comment is hidden because it contains spoiler information about the solution
nice solution.
It is a pity the instructions encourage the use of single character variable names like 's'. Although allowed by PEP8 it is not good practice. https://realpython.com/python-pep8/#how-to-choose-names
There is a bug in the UNITS 70 should be 7.
On reflection: The constants are to complicated. They could be moved to class variables. Have simpler fixed lists of roman numerals and create the ordered dicts on the first call to init. Will revise this when I have time.
from the author
Yes if this code was in a general use package that might be a problem. But for a lot of code readability for maintenance is more crucial than time performance.
nice readable solution.
Minor points:
You have left some "debug code"
The final return statement could be altered to:
The reason is that strings evaluate to
True
unless they are empty.It would be nice to have a docstring explaining what the function does in real code.
This comment is hidden because it contains spoiler information about the solution
The Python Details include
Python does not have a
const
keyword or use semicolon on the end of lines. PEP8 says constant variable names should be all UPPER case