add a tuple to a tuple in Python -


I have a toplele:

  a = (1,2,3) < / Code> 

and I'll end up with a toplele

  b = (4,5)  

Is:

  (1,2,3, (4,5))  

Even if I wrap up the extra guardians: A + (b), I get (1,2,3,4,5) that I do not want.

When you do a + b you simply add both the Tulips Here, you want the whole toplele to be part of another tube. Therefore, we wrap in another tuple.

  a, b = (1, 2, 3), (4,5) print + a + (b) # (1, 2, 3), (4, 5)) < / Code> 

Comments