Having a hard time getting this to work.
options = [
'option 1',
'option 2',
'option 3'
]
for x in range(len(options)):
Opt = str(x + 1)
print('(' + Opt + ')', options[x])
while True:
try:
playerOpt = int(input('input '))
check = 'fail'
for x in range(len(options)):
Opt = x + 1
if playerOpt == Opt:
choice = options[Opt]
check = 'pass'
if check == 'pass':
break
else:
print('Invalid Input<')
except ValueError:
print('Invalid Input')
print(choice)
It's supposed to print out the options in this format:
(1) option 1
(2) option 2
(3) option 3
Then wait for input and check to make sure that input is one of the options and finally set the variable "choice" to that string.