1 #作业
2 # 作业:
3 # 用户输入数字0-100
4 # 程序判断:
5 # 数字>90,成绩为A
6 # 数字>80,成绩为B
7 # 数字>70,成绩为C
8 # 数字<60,成绩为D
9 # 尝试用函数完成?
10
11 def score(name):
12 print("welcome to %s".center(50,"-")%(name.upper()))
13
14 while True:
15 choice = input("please your input score or exit q : ")
16
17 if choice == "q": exit()
18 if choice.isdigit():
19 choice = int(choice)
20 if choice > 100:
21 print("请输入0-100以内的数字")
22 continue
23 if choice == 100:
24 print("%s score is Full Score
" %(name))
25 elif choice >= 90:
26 print("%s score is A
"%name)
27 elif choice >= 80:
28 print("%s score is B
"%name)
29 elif choice >= 60:
30 print("%s score is C
"%name)
31 else:
32 print("%s score is D
"%name)
33
34
35 else:
36 print("请输入0-100以内的数字")
37 continue
38
39 name = input("please your input name: ")
40 score(name)