#2..猜数游戏 # 猜对,打印猜对信息,退出程序 # 最多连续猜三次,连续错三次后询问是否继续玩游戏,是,继续猜,否,退出程序 n=0 sus="66" while n<3: my_sus=input("请猜一个数字:") if(my_sus==sus): print("恭喜你猜对了!数字为:",my_sus) break else: print("很遗憾,您猜错了...") n=n+1 if(n==3): print("您是否继续玩游戏?如果继续请输入y,否则输入n") if (input() == "y"): n=0 continue elif(input()=="n"): print("退出程序") break