Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. list1=[13,13,13,1,2,13,14,15,16,13,13,44,13,13,13]
  2.  
  3. for i,e in enumerate(list1):
  4. if i+1 == len(list1):
  5. break
  6. if list1[i] == 13 and list1[i+1] == 13:
  7. while list1[i]==list1[i+1] and list1[i+1]<=len(list1):
  8. list1.pop(i)
  9.  
  10. while 13 in list1:
  11. if list1[-1] == 13:
  12. list1.pop()
  13. print(list1)
  14. else:
  15. trzyn=list1.index(13)
  16. list1.pop(trzyn+1)
  17. list1.pop(trzyn)
  18.  
  19. print(sum(list1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement