Experiment yourself

Report a typo

The shell provides a great opportunity to test how things work, either the new ones or those you might have forgotten, or things whose working principle you just don't know for sure. For this task, let's experiment a bit with the random module and two of its methods: seed() and choice().

Experiment with it:

  • What will be the result if we run random.choice() with the argument [1, 2, 3, 4, 5]?
  • And if we run it with the same argument several times more?
  • Now, what if we run random.seed(1) before we run random.choice()?
  • And if we run it several times again, but this time initialize random.seed(1) each time before calling choice()?

Write the number you get in the last experiment in the field below.

Enter a number
___

Create a free account to access the full topic