06-round:银行家舍入
语法讲解 今天学: round 的舍入规则 print(round(2.5)) print(round(3.5)) 小练习 运行下面代码后输出是什么?(多行输出请按真实换行提交) print(
05-类型转换:int(float) 是截断
语法讲解 今天学: int() 的截断行为 print(int(3.9)) print(int(-3.9)) 小练习 运行下面代码后输出是什么?(多行输出请按真实换行提交) print(int
04-divmod:一次得到商和余数
语法讲解 今天学: divmod 的返回值 print(divmod(10, 3)) 小练习 运行下面代码后输出是什么? print(divmod(10, 3)) 提交要求: 只提交最
03-取模:% 与负数
语法讲解 今天学: 取模与负数 print(-5 % 2) print(5 % -2) 小练习 运行下面代码后输出是什么?(多行输出请按真实换行提交) print(-5 % 2) print(
02-负数整除:// 的方向
语法讲解 今天学: 负数整除 print(-5 // 2) print(int(-5 / 2)) 小练习 运行下面代码后输出是什么?(多行输出请按真实换行提交) print(-5 // 2)
01-整除与除法:/ 与 // 的差别
语法讲解 今天学: 整数除法与整除 print(5 / 2) print(5 // 2) 小练习 运行下面代码后输出是什么?(多行输出请按真实换行提交) print(5 / 2) print(
30-输入题:title 首字母大写
语法讲解 今天学: title 的用法 s = input() print(s.title()) 小练习 输入为:hello world。运行下面代码后输出是什么? s = input() p
29-输入题:strip 后统计长度
语法讲解 今天学: 输入字符串处理:strip + len s = input() s = s.strip() print(len(s)) 小练习 输入为:␠␠hello␠␠(两端各两个空格)
28-字符串拼接:join 还是 +(概念题)
语法讲解 今天学: 字符串拼接的性能常识 # 概念示例(不要求运行) parts = ["a"] * 10000 s = "".join(parts)
27-难度5:translate 同时替换与删除
语法讲解 今天学: translate:替换 + 删除 s = "Hello World" table = str.maketrans(" ", "_