Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list_of_values = [3,8,9,7]
- def sum_of_valus_plus_index(values):
- sum = 0 # declaring my sum with an initial value of 0
- for value in values:
- sum += values.index(value) + value #generating the sum with index value and positional value
- print(sum)
- sum_of_valus_plus_index(list_of_values)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement