Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Random choice

  • choice
import random

letters = "abcdefghijklmno"
print(random.choice(letters))     # pick one of the letters

fruits = ["Apple", "Banana", "Peach", "Orange", "Durian", "Papaya"]
print(random.choice(fruits))
     # pick one of the fruits