Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
23 lines (16 loc) · 581 Bytes

File metadata and controls

23 lines (16 loc) · 581 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding:utf-8 -*-
__author__ = 'gjw'
__time__ = '2018/1/5 0005 下午 2:49'
# 题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。
# 程序分析:程序分析:(a>b)?a:b这是条件运算符的基本例子。
score = int(input("输入分数:"))
if score >= 90:
g = "A"
elif score >= 60:
g = "B"
else:
g = "C"
print("属于"+g)
# 进阶
print('A' if score > 89 else ('B' if score > 59 else 'C'))
# print('A' and score > 89 or 'B' and score > 59 or 'C')
Morty Proxy This is a proxified and sanitized view of the page, visit original site.