15
Frank Vreys
Last seen 1 day ago
Member for 8 years, 4 months, 1 day
Difficulty Normal
..
Very short and clear solution. I especially like the usage of the
@property and the super() in the Knight subclass.
please-reply@checkio.org schreef op 23/07/2019 2:17:
> Hello frankiser, this solution is from "The Warriors" [1] Mission and in "Clear" category.
>
> 01. class Warrior:
>
More
Good idea how you call rotate90.
In cipher I don't understand why you do test count('X') == 1 . I think it could have been enough to keep only 'elif' statement.
More
Good usage of list comprehensions together with join in the rotate_grill function.
More
Nice recursion in the fight function.
Personally I would have used more OOP concepts: e.g. creation of class
methods to collect or change the class attributes, using getters and
setters.
I don't really understand the test 'not count % 2'
please-reply@checkio.org schreef op 19/06/2019 1
More
This list comprehension with remainder test is a longer statement then using the step-operator to calculate the sum:
array[::2]
More
Capitalization could also be done on result with "capitalize()".
More
You could first rotate the list to check the vertical using zip. It is
worthwhile to check 'zip' in the manual :
rotated_result = zip(*game_result)
More
In the range instruction you could have used the step parameter to avoid the IF statement:
* class range(start, stop[, step])
Nice usage of try .. except .. to cope with an ampty array.
More
Other alternative to validate that len(set(elements) is 0 or 1 is to use the 'in' operator:
len(set(elements) in {0,1}
More
Shortest solution I saw, but still very readable.
The while-loop is a very nice implementation.
please-reply@checkio.org schreef op 23/08/2019 18:17:
> Hello frankiser, this solution is from "The Warriors" [1] Mission and in "Clear" category.
>
> 01. class Warrior:
> 02. health
More
You can also use capitalize() to make first letter of a string a capital letter.
More
Very nice solution with list of tuples of 3 values.
More
Very clear solution.
Eventually you could make the variable name 'res' a little bit more meaningful as 'word_list', 'resulting_words', .. , but this is definitely only a "nice to have".
More
You can make it shorter by only returning the test <=1. Then you avoid the Truu If .. else False construction:
return len(set(elements)) <= 1
More
To populate the dictionary you could have used the get operation with 1 as 'default' parameter
get(key[, default])
or in your code:
dict.get(letter, 1)
With this nice python language structure you can avoid the if .. then .. else ..
More