31
Andrey Solomatin
Last seen 1 year ago
Member for 11 years, 2 months, 8 days
Difficulty Normal
\# in real life use module re
This life is quite real :)
https://docs.python.org/2/library/stdtypes.html#str.isalpha
No need to add branch with nothing.
else: # optionnal
continue # explicitly do nothing
You can use enumerate instead of range.
More
No need braces on line 5
_placements is same as permutation
_all_possible_scores return tuple of two args, but second is not used
comment in line 23 can be placed in docstring
**have_seen_equivalent_for** return True or None
generator expression is too huge
More
str = '' -> shadow builtin function
if Num < 1 or Num > 3999: This check is not required. It makes code more bulky.
(Num, modNum) = divmod(Num, 10) -> Num, modNum = divmod(Num, 10)
numToRomanNum and checkio are two functions that do same job. It is bad design.
read about PEP8
More
don't publish code with debug prints
use string formating not +
read about PEP8
More
'0'+str(data1[0]) use str.zfill or str.ljust
str(data1[0]) string is already string
use string formating not +
read PEP8
More
map isbad name for function argument, it shadows built in function.
unpacking will make code more clear
# map[place[1]][place[0]+1]
y, x = place
map[y][x+1]
You don't change finished flag, remove it and use while True
You don't follow python style guide (PEP8)
Remove u
More
Format string and add string to it is terrebly wrong:
"[{0}]{{2,}}".format("test")
"[%s]{2,}" % "test"
Converting text to upper before any action will make other code more easy.
More
You can call pattern.match. And change if-else section to return. Every time you see code **if True: return True** think if it possible to replace it with return statment.
def letterCheck(argStr1, argStr2):
vowPattern = re.compile('^[AEIOUY]+$')
conPattern = re.compile('^[BC
More
You function has side effects (mutate input data). It is better to create new list and return it. **Pure functions** are more easy for debug and support.
More
**sorted** Return a new sorted list from the items in iterable.
http://docs.python.org/3.3/library/functions.html#sorted
More
Please follow style recomended in [PEP8](http://www.python.org/dev/peps/pep-0008/)
More