SHARE
TWEET

Untitled

a guest Feb 21st, 2020 126 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def sum_of_values_and_indices(a):
  2.     i=0
  3.     new_total=0
  4.     while i <len(a):
  5.         total= a[i]+a.index(a[i])
  6.         new_total +=total
  7.         i+=1
  8.     return new_total
  9.  
  10. print(sum_of_values_and_indices([1,2,3]))
  11. print(sum_of_values_and_indices([0,0,0,0]))
  12. print(sum_of_values_and_indices([]))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top