Advertisement
ancestor_tunji

#sum_of_values_and_indices

Feb 22nd, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. #sum_of_values_and_indices
  2. lists = [1, 2, 3]
  3. def sum_of_values_and_indices(lists):
  4.     total = 0
  5.     for list in lists:
  6.         total += list
  7.         total += lists.index(list)
  8.    
  9.     return(total)
  10. sum_of_values_and_indices(lists)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement