python二级练习(6)
Python 练习 二级
2023-09-14 09:16:25 时间
6. 从键盘接收一百分制成绩(0~100),要求输出其对应的成绩等级A~E。其中,90分以上为'A',80~89分为'B',70~79分为'C',60~69分为'D',60分以下为'E'。
#python 3.6
#蔡军生
#http://blog.csdn.net/caimouse/article/details/51749579
#
dictionary = {90:'A', 80:'B', 70:'C', 60:'D', 0: 'E'}
score = int(input('请输入成绩(0~100):'))
if score > 100 or score < 0:
print('输入错误成绩')
else:
for key in sorted(dictionary.keys(), reverse = True):
if score >= key:
print('成绩为', dictionary[key])
break
输出结果:
========== RESTART: D:/work/example/py_ex_006.py ==========
请输入成绩(0~100):60
成绩为 E
>>>
========== RESTART: D:/work/example/py_ex_006.py ==========
请输入成绩(0~100):70
成绩为 C
>>>
========== RESTART: D:/work/example/py_ex_006.py ==========
请输入成绩(0~100):1010
输入错误成绩
>>>
深入浅出Matplotlib
https://edu.csdn.net/course/detail/6859
深入浅出Numpy
http://edu.csdn.net/course/detail/6149
Python游戏开发入门
相关文章
- 【Python成长之路】python并发学习:多进程与多线程的用法及场景介绍
- 【Python成长之路】python 基础篇 -- 装饰器【华为云分享】
- python基础小练习
- PHP与Python进行数据交互
- Python 字符串_python 字符串截取_python 字符串替换_python 字符串连接
- Python视觉深度学习系列教程 第一卷 第11章 卷积神经网络
- Python:利用python语言实现18位身份证号码和15位身份证号码相互转换
- 智能微电网研究(Python&Matlab代码实现)
- 牛客华为机试第7题python
- Python Flask框架学习25:Flask FastCGI
- Ubuntu下完美切换Python版,即设置系统默认的python版本(亲测有效)
- Python 23种设计模式全(python例子)
- 配置mailx 通过465端口发送邮件 /etc/mail.rc python脚本 发送邮件
- python enumerate
- python IDLE 背景修改 IDLE (Python GUI)
- Python 程序员需要知道的 30 个技巧,看完你的Python技术又进了一步
- Python练习7
- 每日哲学与编程练习4——排序问题(Python实现)
- python二级练习(7)
- python二级练习(12)
- python二级练习(5)
- python二级练习(10)
- python二级练习(3)