Used list comprehension to simplify the code.
Removed useless else.