Python自学:第三章 动手试一试 3-4、3-5

# -*- coding: GBK -*-
liebiao = ["zhang", "li", "wang", "zhou"]
print("wo yao qing :" + liebiao[0] + "、" + liebiao[1] + "、"
+ liebiao[2] + "、" + liebiao[3])

输出为:

wo yao qing :zhang、li、wang、zhou

3-5 修改嘉宾名单

1、

# -*- coding: GBK -*-
liebiao = ["zhang", "li", "wang", "zhou"] print("wo yao qing :" + liebiao[0] + "、" + liebiao[1] + "、"
+ liebiao[2] + "、" + liebiao[3]) print("wang" + "bu hui dao。")

输出为:

wo yao qing :zhang、li、wang、zhou
wangbu hui dao。

2、

# -*- coding: GBK -*-
liebiao = ["zhang", "li", "wang", "zhou"] print("wo yao qing :" + liebiao[0] + "、" + liebiao[1] + "、"
+ liebiao[2] + "、" + liebiao[3]) liebiao.remove("wang")
liebiao.append("dou")

3、

# -*- coding: GBK -*-
liebiao = ["zhang", "li", "wang", "zhou"] print("wo yao qing :" + liebiao[0] + "、" + liebiao[1] + "、"
+ liebiao[2] + "、" + liebiao[3]) liebiao.remove("wang")
liebiao.append("dou") print("wo yao qing:" + liebiao[0] + "、" + liebiao[1] + "、" + liebiao[2]
+ "、" + liebiao[3])

输出为:

wo yao qing :zhang、li、wang、zhou
wo yao qing:zhang、li、zhou、dou
上一篇:JavaScript笔记之Function


下一篇:Java数据类型转换