#try to avoid input function tup = (1,2,3,4,5,6,7,8,9,0,11,22,33,44) ##the number of elements in the tuple. print("number of elements :",len(tup)) ##the minimum element in the tuple. print("minimum value :",min(tup)) ##the maximum element in the tuple. print("maximum value :",max(tup)) ##sum,average,total of tuple. print("sum :",sum(tup),"Average :",sum(tup)/len(tup)) ## using list because tuple is immutable ##tuple in reverse. lit = list(tup) lit = reversed(lit) print("tuple in reverse :",tuple(lit)) ##tuple elements along with indexes. for i in range(len(tup)): print(str(i)+"--"+str(tup[i]))
Click the run button. Try to avoid input() function.