3112213 发表于 2015-11-13 08:26:03

python判断成绩给等级

输入一个测验成绩评定A-F
A:90-100
B:80-89
C:70-79
D:60-69
F:<60

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python
score = int(raw_input('Please enter a score:'))
def print_score(g):
      print "your score is %s " % g
if 90 < score <= 100:
      print_score('A')
elif score > 80:
      print_score('B')
elif score > 70:
      print_score('C')
elif score > 60:
      print_score('D')
else:
      print_score('F')






页: [1]
查看完整版本: python判断成绩给等级