编程语言
首页 > 编程语言> > Python自学:第三章 动手试一试 3-4、3-5

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

 

标签:liebiao,qing,wang,Python,试一试,li,wo,yao,自学
来源: https://www.cnblogs.com/zhouxiin/p/10729966.html