Advertisement
balispecial

7

Feb 22nd, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. list_of_values = [3,8,9,7]
  2. def sum_of_valus_plus_index(values):
  3.     sum = 0 # declaring my sum with an initial value of 0
  4.     for value in values:
  5.         sum += values.index(value) + value #generating the sum with index value and positional value
  6.     print(sum)
  7. sum_of_valus_plus_index(list_of_values)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement