def FilmSelection():
list1=["The Magnificent Seven",'Wreck It Ralph','James Bond','Now you see me 2','Captain America:The Winter Soldier']
choice=input("what film would you like to watch?")
while choice!=str(list1[1:5]):
print("sorry, that film is not available right now")
choiceb=input("would you like to select a different film?")
if choiceb=="yes"or choiceb=="Yes":
print("that's fine")
choice=input("what film would you like to watch?")
else:
print("have a nice day")
sys.exit()
else:
print("lets get to times!")
答案 0 :(得分:0)
当用户输入其中一个电影名称时,您的master
条件将不匹配。
相反,使用这个:
while
这会发现while choice not in list1:
是choice
in
。
此外,您应该执行此操作,而不是使用list1
:
else