成绩计算器未退出
Grade Calculator isn't exiting
我有一个程序应该根据整数输入来近似字母等级。我希望它能够连续 运行 直到输入数字“-1”,然后退出。但是,每当我尝试 运行 它时,程序只会一遍又一遍地告诉我我的成绩,而不会做任何其他事情。这是我到目前为止所拥有的。
import easygui
grade = int(easygui.enterbox(msg="Enter a grade between 0 and 100: "))
while grade != -1:
if grade >= 90 and grade <100:
easygui.msgbox ("You got an A")
if grade >= 80 and grade <90:
easygui.msgbox ("You got a B")
if grade >= 70 and grade <80:
easygui.msgbox ("You got a C")
if grade >= 60 and grade <70:
easygui.msgbox ("You got a D")
if grade >= 0 and grade <60:
easygui.msgbox ("You got an F")
else: raise SystemExit
你需要在while循环中重新获取输入的成绩。
import easygui
grade = int(easygui.enterbox(msg="Enter a grade between 0 and 100: "))
while grade != -1:
if grade >= 90 and grade <100:
easygui.msgbox ("You got an A")
if grade >= 80 and grade <90:
easygui.msgbox ("You got a B")
if grade >= 70 and grade <80:
easygui.msgbox ("You got a C")
if grade >= 60 and grade <70:
easygui.msgbox ("You got a D")
if grade >= 0 and grade <60:
easygui.msgbox ("You got an F")
grade = int(easygui.enterbox(msg="Enter a grade between 0 and 100: "))
else: raise SystemExit
import easygui
等级 = int(easygui.enterbox(msg="Enter a grade between 0 and 100: "))
而等级 != -1:
if grade >= 90 and grade <100:
easygui.msgbox ("You got an A")
if grade >= 80 and grade <90:
easygui.msgbox ("You got a B")
if grade >= 70 and grade <80:
easygui.msgbox ("You got a C")
if grade >= 60 and grade <70:
easygui.msgbox ("You got a D")
if grade >= 0 and grade <60:
easygui.msgbox ("You got an F")
grade = int(easygui.enterbox(msg="Enter a grade between 0 and 100: "))
否则:引发 SystemExit
我有一个程序应该根据整数输入来近似字母等级。我希望它能够连续 运行 直到输入数字“-1”,然后退出。但是,每当我尝试 运行 它时,程序只会一遍又一遍地告诉我我的成绩,而不会做任何其他事情。这是我到目前为止所拥有的。
import easygui
grade = int(easygui.enterbox(msg="Enter a grade between 0 and 100: "))
while grade != -1:
if grade >= 90 and grade <100:
easygui.msgbox ("You got an A")
if grade >= 80 and grade <90:
easygui.msgbox ("You got a B")
if grade >= 70 and grade <80:
easygui.msgbox ("You got a C")
if grade >= 60 and grade <70:
easygui.msgbox ("You got a D")
if grade >= 0 and grade <60:
easygui.msgbox ("You got an F")
else: raise SystemExit
你需要在while循环中重新获取输入的成绩。
import easygui
grade = int(easygui.enterbox(msg="Enter a grade between 0 and 100: "))
while grade != -1:
if grade >= 90 and grade <100:
easygui.msgbox ("You got an A")
if grade >= 80 and grade <90:
easygui.msgbox ("You got a B")
if grade >= 70 and grade <80:
easygui.msgbox ("You got a C")
if grade >= 60 and grade <70:
easygui.msgbox ("You got a D")
if grade >= 0 and grade <60:
easygui.msgbox ("You got an F")
grade = int(easygui.enterbox(msg="Enter a grade between 0 and 100: "))
else: raise SystemExit
import easygui
等级 = int(easygui.enterbox(msg="Enter a grade between 0 and 100: ")) 而等级 != -1:
if grade >= 90 and grade <100:
easygui.msgbox ("You got an A")
if grade >= 80 and grade <90:
easygui.msgbox ("You got a B")
if grade >= 70 and grade <80:
easygui.msgbox ("You got a C")
if grade >= 60 and grade <70:
easygui.msgbox ("You got a D")
if grade >= 0 and grade <60:
easygui.msgbox ("You got an F")
grade = int(easygui.enterbox(msg="Enter a grade between 0 and 100: "))
否则:引发 SystemExit