**- Define a function, the input is an integer between 0-100, and the output is the judgment result of excellent, good, medium, bad, and fail;
-In the main function, test the function of the function.
# -*- coding:utf8 -*-
def judge(chose):
if 90 < chose <= 100:#不能用多个if,否则会多次输出 要用elif
print("优")
elif chose >= 80:
print("良")
elif chose >= 70:
print("中")
elif chose >= 60:
print("差")
elif 0 <= chose < 60:
print("不及格")
else:
print("成绩错误")
def main():
print("请输入成绩:")
chose = int(input())
judge(chose)
if __name__ == '__main__':
main()
Remaining problem: The number entered is not judged, and an error will be reported if it is a non-integer.