while True:
if users_choice!= ('1','2','3','4','5'):
print ('Insufficient input Method')
break
This is inside my main loop. i dont want to place and if for each one.
while True:
if users_choice!= ('1','2','3','4','5'):
print ('Insufficient input Method')
break
This is inside my main loop. i dont want to place and if for each one.
while True:
if users_choice not in ('1','2','3','4','5'):
print ('Insufficient input Method')
break
Operator !=
is actually trying to compare a string
with tuple
. That's why !=
wont work here.
To understand clearly, test this code
users_choice = '0'
while True:
print(type(users_choice))
print(type(('1','2','3','4','5')))
if users_choice not in ('1','2','3','4','5'):
print ('Insufficient input Method')
break