python水题-语法练习
题目传送门
条件判断中的与和或分别为and和or
1 | a = int(input()) |
题目传送门
continue的用法和C语言差不多
1 | n = int(input()) |
1 | n = int(input()) |
题目传送门
不等于(!=)
python print函数用,
连接默认有空格,最后默认有回车,暂时还想不到比较好的方法进行控制,不过用str强转连接也不错
1 | for i in range(1, 10): |
题目传送门
count方法,str.count(str2,pos1,pos2),返回字符串str[pos1,pos2)中str2的数量
1 | str1 = input() |
题目传送门
replace方法,str.replace(str2,str3),返回 将str中所有的str1都替换成str3 的字符串
1 | str1 = input() |