Strings are sequences, there is **no need** to turn them into a list first, `random.choice(string)` works as is. And the latter is trivially done with `list(string)`, no need to write an explicit loop. And `return` is a statement, not a function, just use `return random.choice(string)`.
– Martijn PietersJun 05 '17 at 08:16