Python 随机数猜数字游戏代码示例
import random
a = random.randint(0, 100) b = int(input('请输入0-100之间的整数:'))
while True: if b > 100 or b < 0: print('输入的数字有误') break elif b > a: b = int(input('太高了!请再输一次:')) elif b < a: b = int(input('太低了!请再输一次:')) else: print('猜对了') break
原文地址: https://www.cveoy.top/t/topic/AE5 著作权归作者所有。请勿转载和采集!