Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list1=[13,13,13,1,2,13,14,15,16,13,13,44,13,13,13]
- for i,e in enumerate(list1):
- if i+2 == len(list1):
- break
- if list1[i] == 13 and list1[i+1] == 13 and list1[i+2]==13:
- list1.pop(i)
- list1.pop(i+1)
- elif list1[i] == 13 and list1[i+1] == 13 and list1[i+2]!=13:
- list1.pop(i)
- while 13 in list1:
- if list1[-1] == 13:
- list1.pop()
- print(list1)
- else:
- trzyn=list1.index(13)
- list1.pop(trzyn+1)
- list1.pop(trzyn)
- print(sum(list1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement