45
Valentin Bryukhanov
http://bryukh.com/
Last seen 2 years ago
Member for 11 years, 7 months, 23 days
Difficulty Normal
Developer, engineer and taskMaker.
Whitespaces can be useful. PEP8 can make your code is more readable.
And "Counter" here is overkill, I think. But I sure you can make this pretty and more simpler.
More
Sometimes you are using spaces around operators, sometimes - not. Not bad and if you will make it more "general" then it will be nice solution.
More
Why do you use class here? They look like simple dictionaries here.
More
Not universal, but funny :-) And I like "properties". Nice!
More
Change input data is not a good practice. You can use
work = sorted(data)
instead line 6-7
amount = len(data)
line 9 is overhead
if amount % 2: # the same as amount % 2 != 0
and line 13 is not needed.
More
" == True" is redundant.
"range(0, len(list_of_words))" -- 0 is default, so you can use range(x) == range(0, x)
And you can iterate through list instead indexes:
for w1 in list_of_words:
for w2 in list_of_words:
More
First comment you can make as docstring.
The comments are good -- very readable and simple.
Dictionary comprehension is nice.
More
Of course. Thanks, i tried to solve it with linear equations and made a mistake. Now i see where is my mistake.
More
It's almost "clear" solution. Short and simple, but please don't use long lines -- it's hard for reading. :-) The new PEP8 allows 100 characters per line.
More
It does not look as "Clear" solution. The long lines, the bad names. I agree with [Cjkjvfnby's comment.](http://www.checkio.org/mission/humpty-dumpty/publications/pawlyk/python-27/first/#comment-outer-9032)
More
I am not sure that is "clear" solution :)
c >= 'a' and c <= 'z'
can be
'a' <= c <= 'z'
char_freq[c]+=1
Whitespaces around operator.
char_freq = {chr(c): 0 for c in range(ord('a'), ord('z')+1)}
You don't need prefill your dict, just use dict.get(key, 0)
More