Ad

Using a generator expression is about as fast and much more space efficient than using a list comprehension.

Code
Diff
  • def ultimate_string_jumble_method(s):
        return sum(ord(c) for c in s.replace(' ', ''))
    • def ultimate_string_jumble_method(s):
    • return sum([ord(c) for c in s.replace(' ','')])
    • return sum(ord(c) for c in s.replace(' ', ''))