Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calc7(s):
- # for i in s:
- # if s[i] == 7:
- # ret = s.sub(s[i+1],s[i+1]*2)
- # i += 1
- # return ret
- # ret = sum(s)
- # else:
- # ret = sum(s)
- if len(s) == 0:
- ret = -1
- else:
- ret = sum(s)
- return ret
- 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