Advertisement
Lavig

Практична робота №5

Nov 19th, 2022 (edited)
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. def skip():
  2.     print ("_" * 60)
  3.     print ("_" * 60)
  4. skip()
  5. # Завдання 11
  6. numbers = [206.8, -31.18, 0, 36.9, -313.8, 0.67, -230.2, 0, 21.18, 5.64, 115.36, -270.3, 18.8, 35.7, 6.4]
  7. target_numbers = []
  8. for num in numbers:
  9.     if num > -273 and num < 20:
  10.         target_numbers.append(num)
  11. length = len(target_numbers)
  12. print("Кількість елементів –", length)
  13. numbers_sum = sum(target_numbers)
  14. average = numbers_sum / length
  15. print("Середнє арифметичне елементів –", format(average, '.3f'))
  16. skip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement