使用while循环写一个猜数游戏
num = 7 guess = int(input("请猜一个数字(1-10):")) while guess != num: if guess > num: print("猜的数字太大了") else: print("猜的数字太小了") guess = int(input("请重新猜一个数字(1-10):")) print("恭喜你,猜对了!")
原文地址: https://www.cveoy.top/t/topic/cyQ3 著作权归作者所有。请勿转载和采集!