13
Last seen 5 years ago
Member for 11 years, 5 months, 6 days
Difficulty Normal
Interesting way to ignore the negative entries.
The `l = list(numbers_array)` step is redundant here, passing a `tuple` to `sorted` is fine
More
`sorted` returns a new list, so you don't have to make one.
Also `list(numbers_array)` would make a new list, instead of the list comprehension
More
Bare excepts are always a bad idea unless you re-raise, you'll catch `SystemExit` and `KeyboardInterrupt` for example or silence any unexpected errors. Much better to be specific: `except IndexError`
More
`not ''` always returns `True`, you're not testing the string you just built but an empty string.
Also if nothing is found you should be returning empty string not `'Nothing'`, because your statement is always `True` the else can never be hit currently
More
Probably better off returning 'Fizz Buzz' at the start if the condition is met, rather than assigning it to number and type checking it. You can have more than 1 return statement in a function
More
Could be simplified with a dict comprehension
return {word: text.count(word) for word in words}
More
base = int(max([char for char in number]),36) + 1
Ahhh didn't think of just doing max on the characters!
I got 'base' in a bit more of a complicated way... lol
Oh and btw, you can iterate over strings, eg. max(number)
More