7
Major Taylor
Last seen 8 years ago
Member for 9 years, 10 months, 12 days
Difficulty Normal
You can actually just do min() and max() on the array itself, you don't need to copy it to another list. Right idea though.
More
Why did you define middle then not use it?
Also, it's a good idea to not actually change the data coming in. It'd be best to make a copy of the data before you sort so data remains unchanged.
More
Nice. I didn't know about the "stride" option in slice notation. Very helpful.
More
Instead of potentially using Modulus Division (%) 4 times, is there a way you could minimize that?
Modulus division is a slow operation (compared to assigning a variable), so this would be slightly faster in all cases:
div_by_5 = number % 5 == 0
div_by_3 = number % 3 == 0
if di
More
Your "while" loop could be more clearly written as a "for" loop, and is safer.
Example:
for x in wordlist:
if x.isalpha():
etc...
In Python, x will cycle through the items in the list unless interrupted.
More