python3练习100题——015
原题链接:http://www.runoob.com/python/python-exercise-example15.html
题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。
我的代码:
def fun():
score=int(input("please input the score:"))
if score<60:
grade="C"
elif score<=89:
grade="B"
else:
grade="A" print("%d is grade %s" %(score,grade))
这个if嵌套很容易,就不过多解释啦。
python3练习100题——015的更多相关文章
- python3练习100题——002
因为特殊原因,昨天没有做题.今天继续- 原题链接:http://www.runoob.com/python/python-exercise-example2.html 题目: 企业发放的奖金根据利润提 ...
- python3练习100题——003
今天继续-答案都会通过python3测试- 原题链接:http://www.runoob.com/python/python-exercise-example3.html 题目:一个整数,它加上100 ...
- python3练习100题——004
继续做题-经过python3的测试 原题链接:http://www.runoob.com/python/python-exercise-example4.html 题目:输入某年某月某日,判断这一天是 ...
- python3练习100题——036
原题链接:http://www.runoob.com/python/python-exercise-example36.html 题目:求100之内的素数. 之前有类似的题,所以这次遇到觉得很容易了, ...
- python3练习100题——035
原题链接:http://www.runoob.com/python/python-exercise-example34.html 题目:文本颜色设置. 学习了一下python3 的文本颜色设置. 其实 ...
- python3练习100题——020
原题链接:http://www.runoob.com/python/python-exercise-example20.html 题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半:再落下 ...
- python3练习100题——013
熟悉的水仙花数来了,,,... 原题链接:http://www.runoob.com/python/python-exercise-example13.html 题目:打印出所有的"水仙花数 ...
- python3练习100题——056
题目:画图,学用circle画圆形. 可以用turtle.circle画图. import turtle turtle.setup(0.6,0.6) turtle.pensize(3) turtle. ...
- python3练习100题——050
题目:输出一个随机数. 程序分析:使用 random 模块. import random print( random.randint(1,10) ) # 产生 1 到 10 的一个整数型随机数 pri ...
随机推荐
- opencv —— imread、namedWindow & imshow、cvtColor、imwrite 加载、显示、修改、保存图像
加载图像:imread 函数 Mat imread(const string& filename, int flags = 1): filename:需要载入的图像的路径名. flags:加载 ...
- mysql行转列,函数GROUP_CONCAT(expr)
demo: 语句: SELECT '行' id, '' product_nameUNIONSELECT id, product_name FROM `product` WHERE id < 5 ...
- Wireshark下载地址
官方下载地址: https://www.wireshark.org/download.html
- Ceph集群网络切换
背景:需要对已部署好的Ceph集群切换网络,包含包含公共网络和集群网络 1 关闭所有mon节点的mon服务并修改服务器IP systemctl stop ceph-mon@storage01.serv ...
- C# 中indexOf、lastIndexOf、subString方法的理解
一.indexOf() indexOf("\\"):返回"\\"字符在此实例中第一个出现的索引位置,实例的下标是从0开始,如果未找到则返回-1. indexOf ...
- Redis缓存数据库(一)
先导知识:Memcache Memcache是一个高性能的分布式内存对象缓存系统,代码类似于Hash. 已经有了Memcache,为什么还要用Redis呢? 下面Memcache的缺点: 不支持数据持 ...
- Petya and Array CodeForces - 1042D
很不错的一道题 给你一个长度为n的数组,问共有多少个区间满足区间之和小于给定的数t 这种题一般做法肯定是枚举,固定左端点枚举右端点,枚举的过程需要优化,否则就是n方 这道题我先求一个前缀和,然后逆着枚 ...
- Web简单小结
一.HTML DOM 使 JavaScript 有能力对 HTML 事件做出反应:<h1 onclick="this.innerHTML='你点我干啥'">请点击这里& ...
- LeetCode 3sum-closest 题解
思路 排序 枚举一个数a 双指针移动法确定b和c 求和,更新最接近的值 复杂度 T(n)=O(n2)  M(n)=O(1)T(n)=O(n^2) \; M(n)=O(1)T ...
- 在Scala中免费验证
优锐课带你详细了解如何在Scala中实施免费的monad验证.抽丝剥茧,细说架构那些事! 由于业务数据的复杂性,已经在数据验证上花费了很多精力.在Scala中,提出了使用应用程序进行验证的方法,并被广 ...