Coding Curriculum - Python

String vs Array

Wait a second, this is not what we want! letters is a string and we want an array. Otherwise we cannot use choice, can we?

That is a very good question! However a string is like an array of characters. Every character in the string has an index like an array. Therefore we can use choice(string) to find a random element in a string.