Libraries - random Flashcards
1
Q
blue, yellow, red
Assign one of the colors above randomly to the variable “color”
A
import random
color = random.choice([“blue”, “yellow”, “red”])
random.choice() requires a “sequence”, e.g., List, Tuple, String, range()