pythonExample100/JCP015.py

18 lines
386 B
Python
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

'''
【程序15】
题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示60-89分之间的用B表示
   60分以下的用C表示。
1.程序分析:(a>b)?a:b这是条件运算符的基本例子。
2.程序源代码:
不支持这个运算符
'''
score = int(raw_input('input score:\n'))
if score >= 90:
grade = 'A'
elif score >= 60:
grade = 'B'
else:
grade = 'C'
print '%d belongs to %s' % (score,grade)