On Friday, September 9, 2016 at 12:18:24 PM UTC+5:30, Frank Millman wrote: > Hi all > > This should be easy, but I cannot figure it out. > > Assume you have a tuple of tuples - > > a = ((1, 2), (3, 4)) > > You want to add a new tuple to it, so that it becomes - > > ((1, 2), (3, 4), (5, 6))
Your example does not add inside the inner tuples So I am simplifying the question to > Assume you have a tuple of tuples - > > a = (1 2 3) > > You want to add a new element to it, so that it becomes - > > (1 2 3 4) >>> t = (1,2,3) >>> new = t + (4,) >>> new (1, 2, 3, 4) >>> Slightly harder if the new addition were inbetween >>> t = (1,2,3) >>> t[:1] (1,) >>> t[1:] (2, 3) >>> t[:1] + (42,) + t[1:] (1, 42, 2, 3) -- https://mail.python.org/mailman/listinfo/python-list