M11) Seed inside a loop
The program in Listing 1 is meant to simulate five rolls of a die, so that anyone who runs it gets the same five rolls.
TipHint
random.seed(42) puts Python’s random-number generator in a fixed starting state. random.randint(1, 6) draws one integer from 1 through 6, including both endpoints. append adds each draw to rolls.
Which statement describes the list that the program prints?
- The five values can differ, and every run prints the same list.
- The five values are all equal, and every run prints the same list.
- The five values are all equal, and each run prints a different list.
- The five values can differ, and each run prints a different list.