Python实验四
循环结构
第1关 While 循环与 break 语句
1 | partcount = int(input()) |
第2关 for 循环与 continue 语句
1 | absencenum = int(input()) |
第3关 循环嵌套
1 | studentnum = int(input()) |
第4关 迭代器
1 | List = [] |
顺序与选择结构
第1关 顺序结构
1 | changeOne = int(input()) |
第2关 选择结构:if-else
1 | workYear = int(input()) |
第3关 选择结构 : 三元操作符
1 | jimscore = int(input()) |
Python分支结构训练
第1关 三位水仙花数
1 | n=input() |
第2关 判断闰年
1 | ###begin |
第3关 考试成绩统计
1 | score=input() |
第4关 简单的数字排序
1 | ###begin |
第5关 求一元二次方程的解
1 | ###begin |
第6关 输入一个年份和月份,打印出该月份有多少天。
1 | year,month=map(int,input().split()) |
字符串处理
第1关 字符串的拼接:名字的组成
1 | # coding=utf-8 |
第2关 字符转换
1 | # coding=utf-8 |
第3关 字符串查找与替换
1 | # coding = utf-8 |
Python字符串训练
第1关 字符串格式化
1 | ###begin |
第2关 字符串常用方法
1 | str1 = "apple,pear,peach,banana,pear" |
第3关 文本规范化
1 | text = ''' abcdef 姓名:张三 |
第4关 密码强度判断
1 | import string |
第5关 句子倒序
1 | ###begin |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Crayz's Blog!