import random # from random import choice questions = ['Question1', 'Question2', 'Question3'] random_item = random.choice(questions) print (random_item)
Here is what the above code is Doing:
1. We’ve created a list of questions.
2. We’ve imported the random module.
3. We’ve used the random.choice() function to choose a random question from the list.
4. We’ve stored the question in a variable called random_item.
5. We’ve printed the question to the console.