Advertisement
Korotkodul

dem23.n25_NoneType - WHY???

Jun 17th, 2023 (edited)
835
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. f = open('26.txt')
  2. n = int(f.readline())
  3. lines = f.readlines()
  4. #print(n)
  5. #print(lines[:20])
  6. a = [int(i) for i in lines]
  7. print(type(a))
  8. #print(a[:20])
  9. a = a[::-1]
  10. print(type(a))
  11.  
  12. i = 0
  13. k = 1
  14. lst = 0
  15.  
  16. mx = a[0]
  17. while i + 1 < n:
  18.     i += 1
  19.     if abs(a[i] - a[lst]) >= 3:
  20.         k += 1
  21.         lst = i
  22.         mx = a[i]
  23.    
  24. print(k,mx)
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement