16
Dennis Koopman
Last seen 8 months ago
Member for 6 years, 11 months, 9 days
Difficulty Normal
I wanted to solve 50 CheckiO missions to improve my Python and algorithm skills. It proved to be more more effective and more fun than I thought, so I kept going.
Nice solution. I like how you optimise your import statement. Using sets also nice touch.
More
Nice solution. No necessary to create variable half. You could put it's logic straight into the if clause on line 3.
More
Nice solution. One question though. Why not just put self.health = 50 in the Knight's __init__ method? Saves one from having to look it up in the parent class.
More
I like how you convert the error message into useful variables in one line of code (line 13).
More
line 6 and 7 can be simplified into one line, like this:
day, time, secs = call.split()
More
Great that Python allows you to solve this in 3 lines of logic (2 if you ignore the PEP8 Style Guide).
More
Great solution! I like how you iterate over the dict instead of the string.
More
Under Clear I published a different solution. That one uses a dictionary to handle the error message instead of this ugly if-elif-else loop. However, looping was slightly faster for most test cases.
More
If you remove line 4 and lines 7 to 15 your solution would look even
cleaner.
More
If you remove lines 5 to 11 your solution would look even cleaner. These
lines are not needed when you check your solution.
More
Thx for the input! Do you mean:
* make messi, ronaldo and mbape lists instead of strings (line 5)
* then append to list, instead of mutating string with += (lines 7 to 9)
* then join the lists and convert resulting string into int (lines 10 to 12)
More
Nice solution. You could skip creating the variables on line 3 and 4 and put all the logic in the if-else clause. Fewer lines, but just as readable.
More
Very impressive solution! And great that you make an effort to explain this stuff.
More