15
LLluma
Last seen 1 month ago
Member for 10 years, 3 months, 23 days
Difficulty Normal
Better do not import something in the body of a function.
'len(letter*i)' just equal 'i'
More
temp = res[j + 1]
res[j + 1] = res[j]
res[j] = temp
is equal to
res[j + 1], res[j] = res[j], res[j + 1]
More
line.lower() is doing nothing. Probably you mean line = line.lower().
String type in the Python is immutable, so all string methods like lower, upper and so, is returning a new string but not modify existing.
Better not name variables like min, max, dict and other names which are names of built-in f
More
For checking if string or list is empty, use 'if not line:'. That is more pythonic.
More
It is better to import re outside of the function.
Also is better compile pattern before using.
More