我知道它的内容很愚蠢而且容易,但是我可以在结果制定完毕并在最后一次声明中给出后如何结束程序运行,提前感谢。
def main():
pass
Name = raw_input("Enter your name: ")
while True:
HealthScore = int(raw_input("Enter your standardised health score: "))
try:
if 0 <= int(HealthScore) <= 100:
break
except ValueError:
print("The number must be in the range 0-100")
while True:
EconomicOutput = int(raw_input("Enter your standardised economic output score: "))
try:
if 0 <= int(EconomicOutput) <= 100:
break
except ValueError:
print("The number must be in the range 0-100")
while True:
Grade = (raw_input("Enter your standardised Grade: "))
try:
if Grade in ['A', 'B', 'C', 'D', 'E', 'F']:
break
except ValueError:
print("Grade is incorrect")
while True:
try:
if Grade is 'A':
print("congratulations, You meet the exceptional criteria")
break
elif EconomicOutput > 85 :
print("congratulations, You meet the exceptional criteria")
break
elif EconomicOutput > 60 and HealthScore > 60 and Grade is 'B' or EconomicOutput > 60 and HealthScore > 60 and Grade is 'C':
print("congratulations, " + Name + " you have been selected.")
break
else:
print("Sorry, you do not meet the criteria")
break
if __name__ == '__main__':
main()
答案 0 :(得分:0)
使用sys.exit(1)
import sys
if Grade == 'A':
print("congratulations, You meet the exceptional criteria")
sys.exit(1)
和完成
在休息的地方;添加sys.exit(1) 那只是一个例子