python用while求平均值

怎么用Python 的for循环和while循环算平均数
分别用for和while 在1到10里任意输入五个数然后算出他们的平均值.求大神

第1个回答  2019-07-15
m = 0for i in range(5): s = raw_input() m += float(s)/5.0 print 'the average is: ',m i = 0m = 0while i < 5: s = raw_input() i += 1 m += float(s)/5.0print 'the average is: ',m
相似回答