我试图获得一个循环,允许用户选择“是”或“否”,如果不是,程序说无效输入和重复。我每次都得到无效的输入,它不会给我一个“是”或“没有”
def main():
choice = raw_input("Would you like to open a file? (yes or no) ")
while true:
if choice is 'no':
print("Goodbye")
break
elif choice != "yes" or choice != "no":
print("invalid input")
break
elif choice is 'yes':
file = get_file()
image = make_image(file)
show_image(image)
def get_file():
file = pickAFile()
return file
def make_image(file):
image = makePicture(file)
return image
def show_image(image):
show(image)
main()