i'm beginner. i want user read question from list and enter 1,2,3 or 4 for answer but i have problem when user don't enter number and press enter . ValueError: invalid literal for int() with base 10: ''
print("read question and answer :enter 1 , 2, 3 or 4")
q1=[
"question1 ",
"question2 ",
"question3 ",
"question4 ",
]
ans=[]
for x in range(len(q1)):
try:
element=int(input(q1[x]))
while element not in [1,2,3,4]:
element=int(input(q1[x]))
else:
ans.append(element)
except ValueError:
element=int(input(q1[x]))
print(ans)
please help me.