首页  

python猜数字小游戏     所属分类 python 浏览量 846
python guess.py 
 
输入非数字报错

please input a int number 1~100 :aa
Traceback (most recent call last):
  File "guess.py", line 6, in <module>
    number=int(input("please input a int number 1~100 :"))
  File "<string>", line 1, in <module>
NameError: name 'aa' is not defined




import random computer=random.randint(0,100)+1 while True: number=int(input("please input a int number 1~100 :")) if(number >100 or number <= 0): print("please input a int number 1~100 :") elif(number > computer): print("big") elif(number < computer): print("small") elif(number==computer): print("right!") break else: print("please input a int number 1~100 :")

上一篇     下一篇
java 猜数字

go猜数字游戏

Rust安装

javascript猜数字小游戏

go程序设计语言前言

go程序设计语言01_01入门之hello