def f(t):
    res = t[-1]
for x in t[-2::-1]:
    res = x + (res,)
return res
t = (1,), (1, 2), (1, 2, 3), (1, 2, 3, 4), (1, 2, 3, 4, 5)
print(f(t))
Convert from tuple of tuples to nested tuples in Python