|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
这个写的对吗
import random
tem = random.randint(1,10)
print("------------------------进行猜测数字------------------")
math = input("猜测数字:")
guess=int(math)
if guess==tem:
print ("zhengque")
else:
print ("cuowu")
cishu=1
while guess != tem and cishu<=3:
cishu=cishu+1
math=input("猜错错误,再猜:")
guess=int(math)
if guess==tem:
print ("成功了")
elif guess>tem:
print("大了")
else:
print("数字小了")
if cishu>3:
print ("ni de ci shu yong wan le")
没有问题,就是你可以用中文
如果发这种形式的代码
- import random
- tem = random.randint(1,10)
- print("------------------------进行猜测数字------------------")
- math = input("猜测数字:")
- guess=int(math)
- if guess==tem:
- print ("zhengque")
- else:
- print ("cuowu")
- cishu=1
- while guess != tem and cishu<=3:
- cishu=cishu+1
- math=input("猜错错误,再猜:")
- guess=int(math)
- if guess==tem:
- print ("成功了")
- elif guess>tem:
- print("大了")
- else:
- print("数字小了")
- if cishu>3:
- print ("ni de ci shu yong wan le")
复制代码
|
|