Python 15
[Python 100] Python 100
>=90A60-89B60C
(a>b) ? a:b
(Python 2.x)
#!/usr/bin/python
# -*- coding: UTF-8 -*-
score = int(raw_input(':\n'))
if score >= 90:
grade = 'A'
elif score >= 60:
grade = 'B'
else:
grade = 'C'
print '%d %s' % (score,grade)
(Python 3.x)
#!/usr/bin/python3
score = int(input(':\n'))
if score >= 90:
grade = 'A'
elif score >= 60:
grade = 'B'
else:
grade = 'C'
print ('%d %s' % (score,grade))
: 89 89 B
[Python 100] Python 100
james
214***[email protected]
range
#!/usr/bin/python # -*- coding: UTF-8 -*- def k(x): if x in range(60): print('C') elif x in range(60,90): print('B') else: print('A') score = int(raw_input(':\n')) k(score)james
214***[email protected]
huj***[email protected]
#!/user/bin/python # -*- coding: UTF-8 -*- a=int(raw_input('')) # print 'A' if a>89 else ('B' if a>59 else 'C') # print 'A' and a>89 or 'B' and a>59 or 'C'huj***[email protected]
123***6.com
#!/usr/bin/python # -*- coding: UTF-8 -*- i= int(input('')) ar= [90,60,0] res= ['A','B','C'] for idx in range (0,3): if i >=ar[idx]: print(res[idx]) break123***6.com
me@***gdewen.com
0-100
# coding:utf-8 score = int(raw_input(':\n')) print(['C','C','B','A'][score/30])me@***gdewen.com
neuqsc
186***[email protected]
Python3.xPython2.x
# -*- coding: UTF-8 -*- score = [80,78,90,48,62] #5 grade = [] # for i in range(5): s = (score[i]>=90)and 'A' or ((score[i]>=60)and 'B' or 'C') grade.append(s) print (grade)neuqsc
186***[email protected]