Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. # Python 3.6.0
  2.  
  3. def calc7(numbers):
  4. if not numbers:
  5. return -1
  6. rate = 1
  7. total = 0
  8. for n in numbers:
  9. total = total + (n * rate)
  10. if n == 7:
  11. rate = 2
  12. else:
  13. rate = 1
  14. return total
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement