记录日常学习中遇到的问题
1. 列表的相加(拼接)
list1=[1,2,3]
list2=[4,5,6]
list3=list1+list2
print(list3 )
[outs]:X:\python\venv\Scripts\python.exe .xml
[1, 2, 3, 4, 5, 6]
2.列表元素的相加
list1=[1,2,3]
list2=[4,5,6]
list3=[]
for m,n in zip(list1,list2):
per_list3=m+n
list3.append(per_list3)
print(list3 )
[outs]:X:\python\venv\Scripts\python.exe .xml
[5, 7, 9]