鱼C论坛

 找回密码
 立即注册
查看: 2608|回复: 2

求大佬看看为什么这个代码是错的,跑不起来

[复制链接]
发表于 2023-11-2 23:01:39 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
while score=="e":
score = input("请输入你的分数:")
score = int(score)
if score < 60:
    print("D")
   
if 60 <= score < 80:
    print("C")

if 80 <= score < 90:
    print("B")

if 90 <= score < 100:
    print("A")

if score == 100:
    print("S")

为什么我先假定"score==e"跑不通报错误?还有“while x=0=e”也是错的,不能设两个条件的吗?我在后面加 "if score="e" 也跑不通呢请问?
                                                                                                                                                             break

score = input("请输入你的分数:")
while score != 'e':
    score = int(score)

    if score < 60:
        print("D")

    if 60 <= score < 80:
        print("C")

    if 80 <= score < 90:
        print("B")

    if 90 <= score < 100:
        print("A")

    if score == 100:
        print("S")

    score = input("请输入你的分数:")
为什么上面的“while score!="e"”,等号前面要加“!”,不加就报错误? 麻烦各位大佬帮忙解读一下
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-10-1 02:29

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表