Login and get codingWrite a function that accepts a list of strings and returns the total of the indices of the items.
Example 1:
['a', 'b', 'c']
=>0 + 1 + 2 = 3
The indices for duplicate items should be accumulated in the total as they appear.
Example 2:
['a', 'b', 'b', 'c']
=>0 + 1 + (1+2) + 3 = 7
Example 3:
['a', 'b', 'b', 'c', 'a', 'b', 'a']
=>0 + 1 + (1+2) + 3 + (0+4) + (1+2+5) + (0+4+6) = 29
58 out of 60 users completed this Bite.
Will you be Pythonista #59 to crack this Bite?
Resolution time: ~37 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 3.0 on a 1-10 difficulty scale.
» You can do it! 😌