标签:用户 logs 数字 git put tin while continue span
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\n" %(name))
25 elif choice >= 90:
26 print("%s score is A\n"%name)
27 elif choice >= 80:
28 print("%s score is B\n"%name)
29 elif choice >= 60:
30 print("%s score is C\n"%name)
31 else:
32 print("%s score is D\n"%name)
33
34
35 else:
36 print("请输入0-100以内的数字")
37 continue
38
39 name = input("please your input name: ")
40 score(name)
标签:用户 logs 数字 git put tin while continue span
原文地址:http://www.cnblogs.com/gaoyuan111/p/6816052.html