tuple = (1, 5, 12). s = 0. i = 0. while(i < len (tuple)):. s = s + tuple[i]. i+ = 1. print(“Sum of elements in tuple is “ , s). Output:.
確定! 回上一頁