go = 1 while go: name = input("请输入您的姓名:") sex = input("请输入您的性别:") age = input("请输入您的年龄:") print('您的信息如下:') print(f"姓名:{name}") print(f"性别:{sex}") print(f"年龄:{age}") index = input("是否继续?请输入yes或者no:") if index == 'yes': go = 1 else: if index == 'no': print("程序运行结束!") go = 0 else: index2 = input("输入错误,请重新输入yes或者no:") while index2: if index2 == 'yes': go = 1 break else: if index2 == 'no': go = 0 break else: index2 = input("输入错误,请重新输入yes或者no:")