Advertisement
TShiva

Mediaт vs mean

May 13th, 2017
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. numbers=[1,2,3,-20,10]
  2. mean=0
  3. for i in numbers:
  4.     mean=i+mean
  5. mean=mean/len(numbers)
  6. i=1
  7. '''while i < len(numbers):
  8.    j=0
  9.    for j in range(len(numbers)-i):
  10.        if numbers[j] < numbers[j+1]:
  11.            numbers[j], numbers[j+1] = numbers[j+1], numbers[j]
  12.    i=i+1'''
  13. numbers.sort()
  14. median_number=numbers[int(len(numbers)/2)]
  15. if mean > median_number:
  16.     print('mean')
  17. elif median_number > mean:
  18.     print('median')
  19. elif median_number == mean:
  20.     print('same')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement