#try to avoid input function a = ((1,2,3,4,0),(11,22,3,44,5),(-111,-23,-345,-4567),(100,100,10),(11,1),(66,99,66,99,66,99),(109,202,106,404),(9,99,-99,99)) for i in range(len(a)):## sort each sub tuple. new = sorted(a[i]) a = list(a) a[i] = tuple(new) a = tuple(a) print(a) print("last elements of each sub tuple.") for i in a:## last elements of each sub tuple. print(i[-1:]) print("the total of all the sub tuples.") for i in a:## the total of all the sub tuples. print(sum(i))
Click the run button. Try to avoid input() function.