Day_3 · 字符串:和文字打交道 #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
今日知识点
+(如"你" + "好")f"你好,{name}!"—— 大括号里直接放变量len(s)长度、s.upper()大写、s.lower()小写、s.strip()去首尾空格、s.split(" ")按空格切分先学(教程)
任务(后做)
words = "apple banana cherry".split(" "),打印切出来的列表,再数一数有几个单词(用
len(words))。完成标准
提交方式:把
day3.py代码贴在当日工单评论里。参考解答(先做再看)
3
1
喵
作业
王士宇来啦
。
王若琪
day3完成
1
1
3
`name="胡翰林"
age=int(18)
city="株洲"
print(f"我叫%s,今年%d岁,来自%s"%(name,age,city))
s="Hello World"
print(len(s))
print(s.upper())
print(s.lower())
print(s.strip())
print("单词数",len(s.split()))
`
。
Day_3 · 字符串(f-string + 常用字符串方法)