You can achieve this by using Python's random
module to randomly select one of the phrases. Here is an example code snippet that does exactly that:
import random
# List of phrases to congratulate the student
phrases = [
"Great job! You got it right!",
"Well done! That's correct!",
"Awesome! You're on the right track!",
"Fantastic! You answered correctly!"
]
# Function to select and print a random phrase
def congratulate_student():
selected_phrase = random.choice(phrases)
print(selected_phrase)
# Call the function
congratulate_student()
When you run this code, it will randomly select one of the four congratulatory phrases and print it to the console. You can call the congratulate_student()
function each time a student answers correctly to provide them with a random positive feedback message.