DialOG_

Untitled

Jan 24th, 2021
752
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. with open('5task.txt','r') as f:
  2.     text = f.read()
  3.  
  4. lines = text.split('\n')
  5.  
  6. izmer = int(lines[0].split()[0])
  7. wrong = int(lines[0].split()[1])
  8.  
  9.  
  10. del lines[0]
  11. del lines[-1]
  12. nums = []
  13. for i in lines:
  14.     nums.append(int(i))
  15. nums.sort()
  16.  
  17. delta = izmer - wrong
  18. z = 0
  19. for i in nums:
  20.     while z <50:
  21.         del nums[0]
  22.         del nums[-1]
  23.         z+=1
  24. s = 0
  25. for i in nums:
  26.     s+=i
  27. avg = int(s/len(nums))
  28. print(max(nums),avg)
  29.  
RAW Paste Data