I'm trying to make a program that simulates the game "Door of Hope" of Silvio Santos in Pyton and I need the program to generate a random number, excluding the number generated previously. I did this:
premio = rd.randint(1,3)
p = int(premio)
print(p)
w = rd.sample(range(1,3), p)
print(w)
But a warning appears saying that the sample is larger than the population. I do not know how to do it any other way!
Q: For those who want to help with the program as a whole, here's the question:
Make a program that simulates the behavior of Silvio Santos. Your program should:
randomly choose one of the three doors and place the prize behind it (do not tell the user where the prize is); request the user to choose one of three ports; open a door that does not have the prize and that the user has not chosen (if there is more than one choice for the door to be open, your program should open any of them with equal probability); show the user which port was opened; Ask the user if he wants to keep his initial choice or if he wants to change the port; show the user whether or not he won the prize.