8
Last seen 1 year ago
Member for 12 years, 8 months, 20 days
Difficulty Normal
Well done! I did not expect this to work with empty lists as well. :D
More
You can change this:
"for i in range(len(data)): x = data[i]"
directly to
"for c in data: x = c"
More
You can replace
if digit == 0 or upper == 0 or lower == 0:
like this
if 0 in (digit, upper, lower):
More
The comment should be inside the function it comments on.
Also, if you feel you need to explain you one-letter-length variables, then maybe use longer and more descriptive names to begin with.
More
But why
import collections
and not
from collections import counter
when this is the only item you use from there?
More
You can combine your two if-statements into one with the "and", like you did in the second line anyway.
Also, if you have a pattern like this:
if check_something and something_else:
return True
else:
return False
You can cut it short into th
More