我爱派森love 发表于 2021-11-18 19:44:02

救救孩子吧 各位大神

自己写的{:10_277:}
temp = input("请输入你的分数")
while temp != "e":
    cj = int(temp)

    if cj == 100:
      print("S")
    else:
      if cj >= 90:
            print("A")
      else:
            if cj >= 80:
                print("B")
            else:
                if cj >= 60:
                  print("C")
                else:
                  print("D")
    print("请输入你的分数")
    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("请输入你的分数:")


若按照我自己写的怎样改才能达到小甲鱼的效果   欢迎各位大神来解答

小仙 发表于 2021-11-19 01:07:19

temp = input("请输入你的分数")。把这段取代break,因为break作用就是跳出这段循环代码的。相当于只执行了一次
页: [1]
查看完整版本: 救救孩子吧 各位大神