How to loop an input from user?

Viewed 69

How can I begin a loop where the given input;

raffle_ticket = input("Enter Participant Here: ")

repeated until I get maximum 20 participant inputs from user, then break the input loop when I get 20 participants?

1 Answers

You can use a for loop and store the input from user into a list:

raffle_ticket = []

for i in range(0,20):
    raffle_ticket.append(input("Enter Participant Here: ")) 
    
print(raffle_ticket)
Related