Commit d80dd5ce by BellCodeEditor

save project

parent 30cb799c
Showing with 6 additions and 18 deletions
# 序列拆包:右侧一个序列,左侧多个遍历
tuple_surname = "黄", "孙", ["红", "黄", "绿"]
print(type(tuple_surname))
a, b, c = tuple_surname
print(a, b, c) # "黄", "孙", "钱"
print(type(c))
list_color = [["红", "黄", "绿"], "黄", "绿"]
a, b, c = list_color
print(a, b, c) # "红", "黄", "绿"
print(type(a))
a, b, c = "[1,2,3]禄寿"
print(a, b, c) # "福", "禄", "寿"
print(type(a))
# 需要进行加密的语句
message = "诺依,周末一起去看动漫展吧!"
# 请对message进行遍历,取出所有元素
for i in message:
# print(i)
print(i,end=" ") # added by hg
# 变量交换:a,b=b,a
name01 = "小华"
name02 = "小明"
name01, name02 = name02, name01 # 相当于序列拆包的 name01,name02 = (name02, name01)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment