Advertisement
biswasrohit20

one

Mar 29th, 2021
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. nums = []
  2. while True:
  3. num = int(input("Please enter a number: "))
  4. if num == 0:
  5. break
  6. nums.append(num)
  7.  
  8. average = sum(nums)/len(nums)
  9. print(f'The average is {str(average)}')
  10. less = []
  11. equal = []
  12. more = []
  13. for i in nums:
  14. if i < average:
  15. less.append(i)
  16. elif i == average:
  17. equal.append(i)
  18. elif i > average:
  19. more.append(i)
  20.  
  21. print("The numbers less than the average are: ", less)
  22. print("The numbers equal to the average are: ", equal)
  23. print("The numbers more than the average are: ", more)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement