How do i add two lists' elements into one list?

前端 未结 4 1094
执笔经年
执笔经年 2020-12-10 12:13

For example, I have a list like this:

list1 = [good, bad, tall, big]

list2 = [boy, girl, guy, man]

and I want to make a list like this:

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 12:29

    Using zip

    list3 = []
    for l1,l2 in zip(list1,list2):
        list3.append(l1+l2)
    

    list3 = ['goodboy', 'badgirl', 'tallguy', 'bigman']

提交回复
热议问题