how to join 2 lists in a third list?

Asked

Viewed 24 times

0

what I wanted is a third list to receive the content of the other two but putting together and on the same list, like:

a = [1, 2, 3]
b = ['ola, mundo', 'oi']
c = [[1, 2, 3, 'ola, mundo', 'oi'], [], []]

And by putting this code in a repeating structure, every time it repeats it will put the information from A and B in a new C bracket all together, the repeating part I was able to do, the problem is getting them together in a single bracket. There is a function for this or some technique?

I have tried with the append and extend but they return each in a separate bracket and do not join all. comes out something similar to:

c = [[1,2,3], ['ola,mundo, 'oi'], [], []]
  • 1

    Try something simpler, like c = a + b

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.