Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calc7(l):
- if len(l) == 0:
- return -1
- sum = 0
- for i, j in enumerate(l):
- if j == 7 and i < len(l)-1:
- l[i+1] *= 2
- sum += j
- return sum
- print(calc7([1, 2]))
- print(calc7([3, 7]))
- print(calc7([7, 5, 6]))
- print(calc7([7, 9, 7, 9, 7, 9]))
- print(calc7([]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement