python 猜数字,显示猜了几次?
python,这个程序里怎么加能显示猜的次数?number=6guess=1print("猜数字!")whileguess!=number:guess=int(input...
python,这个程序里怎么加能显示猜的次数?
number = 6
guess = 1
print("猜数字!")
while guess != number:
guess = int(input("请输入你猜的数字:"))
if guess == number:
print("恭喜你猜对了!")
elif guess < number:
print("小了")
elif guess > number:
print("大了") 展开
number = 6
guess = 1
print("猜数字!")
while guess != number:
guess = int(input("请输入你猜的数字:"))
if guess == number:
print("恭喜你猜对了!")
elif guess < number:
print("小了")
elif guess > number:
print("大了") 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询