Avatar ·

Random text in Python

📁 Advanced Python Topics, example, Beginner

How to make random text in Python? So that it displays only 1 variable out of two? For example, I have two variables with the following values:

 import random role1 = "Peaceful resident" role2 = "Mafia" role = random.randint(role1, role2) print("You are - " + role) input() 

And I need only one variable to be displayed when outputting the text. Moreover, each time - different, sometimes role1, sometimes role2, then again role1.

I hope I explained it clearly. I am a beginner in Python and I ask you to answer in more detail.