quick question i have come across, i can't find a definition for it perhaps i'll have to make a couple lines to define it?
anyways for list a, which has only integers, i need to define the average, x...
so i'm looking for something quick to do this:
>>>a = [1,1,3,5,7,10] >>>#something here >>>print (x) 13.5
i realize this is an extremely simple question so quick responses are highly appreciated
edit: actually i guess i found a way, probably not the best though lol
a = [1,2,35,3,2] j = 0 u = 0 for f in a: j = j + f u = u + 1 x = j/u print(x)
i got 8.6 which is in fact the average...
this had such a simple solution kind of feel stupid for asking