Dec-07-2022, 12:21 PM
I am trying to set the counter to the one less if the input does not match with list. However, it seems that it does not set the counter. Any idea please?
team=["Arsenal","Liverpool","New Castle","Tottenham"] t_ins=[] count=0 for i in range(count,4): names=str(input("Please enter the name of a Football Club ")) if names not in team: print("The name inputed does not exist. The team names are ",team) print("Try Again ") count=count-1 continue else: t_ins.append(names) print(t_ins)
Output:Please enter the name of a Football Club chelse
The name inputed does not exist. The team names are ['Arsenal', 'Liverpool', 'New Castle', 'Tottenham']
Try Again
Please enter the name of a Football Club Arsanal
The name inputed does not exist. The team names are ['Arsenal', 'Liverpool', 'New Castle', 'Tottenham']
Try Again
Please enter the name of a Football Club Arsenal
Please enter the name of a Football Club Liverpool
['Arsenal', 'Liverpool']