Assume that I have an input as [(1,2,3),(4.5,-2,7.4)].
I need an output like (2.0,3.3).
I cannot use any imports.
I know an average is like:
list = int(input())
ave = sum(list)/len(list)
print(list)
but I don't know how to calculate each tuple's average. Ok now I know the answer my codes is as follows:
list = list(x)
print([sum(i) / len(i) for i in list])
x is just the value I named to read the input list of tuples as string and I have to, I cannot change it, but when I put [(15.5, 8, 16.46), (7, 56, 4.21884, -1.4, 8.3), ((4.5,-2,7.4)] as input, I get [13.32, 14.823767999999998, 3.3000000000000003].
I want to get (13.32 , 14.82, 3.33) as output and I am not allowed to use round().