i'm trying to make the user only pick values from a list and if he picks other values outside the list I want the code to ask again for the correct value
my attempt :
accepted_values = [0, 1, 2, 3, 4]
while True:
print('Enter two numbers from the list :', accepted_values)
first_num = input("Enter first_num: ")
second_num = input("Enter second_num: ")
userinput = []
userinput.append(int(first_num))
userinput.append(int(second_num))
if userinput not in accepted_values:
print('please enter numbers from this range:', accepted_values)
continue
else:
break
but it results in a loop of it asking me to enter the correct values even if I enter a correct number