基础命令进阶练习配图
程序原理图
程序原理说明
通过程序完成把li和pingguo复制到pingguo_li中,从而完成上图效果。
上干货,程序代码
pingguo = ['apple-0','apple-1','apple-2','apple-3','apple-4','apple-5',]
pingguo_li = []
li = ['pear-0','pear-1','pear-2','pear-3','pear-4','pear-5',]
for pg,li_unit in zip(pingguo,li):
pingguo_li.append(pg)
pingguo_li.append(li_unit)
print(pingguo_li)
程序输出结果:
[‘apple-0’, ‘pear-0’, ‘apple-1’, ‘pear-1’, ‘apple-2’, ‘pear-2’, ‘apple-3’, ‘pear-3’, ‘apple-4’, ‘pear-4’, ‘apple-5’, ‘pear-5’]