31
Andrey Solomatin
Last seen 1 year ago
Member for 11 years, 2 months, 8 days
Difficulty Normal
It is very hard to read such code
Don't write multiline oneliners
Use ** instead of math.pow
More
You count key for each element twice. See nickie [comment](www.checkio.org/mission/min-max/publications/Sim0000/python-3/first/#comment-outer-12784)
Don't use spaces around **=** in function definition and call.
I prefer to make all arguments required in case of min_max. You use key in all cas
More
No need to use deque here. list.pop is enough.
You call area for each point it is super ineffective.
You mutate checkio argument, it is not issue but bad practice.
http://www.checkio.org/forum/post/1618/proper-way-to-check-if-sequence-is-empty/
More
no: **p = list(map(lambda x:None, METALS))** yes: **p = [None] * len(METALS)**
no: **if p[idx] == None:** yes: **if p[idx] is None:**
no: **[frac,]** yes: **[frac]**
you can replace: **sary = list(map(sum, zip(sary,div)))** with more readable list comprehansion **sary = [sum(x) for x in zip
More
no: **((number%3) == 0)** yes: **number % 3 == 0**
no: **if len(msg) > 0** yes: **if msg**
More
**open** is builtin python function (even it does not present here) don't shadow it.
You doc string for checkio not uses recommenced quotes. And it does not describe that function do.
More
This looks bad: **line = [0 for i in range(0,num)]** you can use: **line = [0] * num**
You can use **copy.copy(line)** or **list(line)** or **line[:]** in line 39. No need to deepcopy.
More
There is function in standard library that do the same as **lambda x: abs(x)** you should use it instead of this lambda.
More
You did not need range if you need only value.
for x in data:
counter = data.count(x)
For cases then you need both index and value use enumerate:
for i, val in enumerate(data):
print(i, val)
More
no: **word == other\_word[-len(word):]** yes: **other\_word.endswith(word)**
More
You can skip parenthesis:
if number % 5 == 0 and number % 3 == 0:
PS. Please follow python style guide (PEP8)
More
Very complex:
zip([game_result[i][0] for i in range(3)], [game_result[i][1] for i in range(3)], [game_result[i][2] for i in range(3)])
same as:
[tuple(x) for x in game_result]
zip([game_result[0][0]], [game_result[1][1]], [game_result[2][2]])
same as:
[(game_result[0][0], game_result[1
More