#coding=gbk #coding=utf-8 #-*- coding: UTF-8 -*- from encodings import utf_8 import random print(‘--------猜一猜游戏------------‘) num1 = int(input("请输入开始的区间数:")) num2 = int(input("请输入结束的区间数:")) number = random.randint(num1,num2) while True: temp = int(input(‘猜一个数字:‘)) if number == temp: print(‘恭喜你猜对了!‘) break elif number > temp: print(‘小了‘) elif number < temp: print(‘大了‘) elif temp.isdigit(): continue else: print(‘游戏结束‘)
原文地址:https://www.cnblogs.com/AIHEN/p/9011656.html
时间: 2024-11-08 21:26:56