Python这也太怪了吧
这是代码1while True:
temp = input('请输入一个整数')
while not temp.isdigit():
temp = input("输入错误,请重新输入。")
secret = int(temp)
while secret > 100 or secret < 0:
temp = input("请输入0到100之前的数字。")
secret = int(temp)
if secret>80 and secret <= 100:
print("A")
elif secret<=80 and secret>60:
print("B")
elif secret>40 and secret<=60:
print("C")
else:
print("D")
这是代码二
while True:
temp = input('请输入一个整数')
while not temp.isdigit(): # 更改
temp = input("输入错误,请重新输入。")
secret = int(temp)
while secret > 100 or secret < 0:
temp = input("请输入0到100之前的数字。") # 更改
secret = int(temp) # 更改
if secret > 80 and secret <= 100:
print("A")
elif secret <= 80 and secret > 60:
print("B")
elif secret > 40 and secret <= 60:
print("C")
else:
print("D")
天啊,这明明一样啊,,,为什么我的运行不了,,代码一是我的,代码二是某版主更改过的,,,为什么代码二可以运行,代码一却错误??
这两个代码哪里错误了吗?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????一脸懵逼
检查一下缩进,标点符号括号是否是英文等 检查下你报错的信息,有提示。 报错信息?
我这里没有问题 代码没问题,我这正常跑
woc卧槽,,,我把外壳关了,啊然后打开,就成功了,哈哈哈
页:
[1]