Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def super_sum(string): #declares the function super_sum
- f = [] #stores the index of s
- for i in string:
- for j in i:
- if j == 's':
- man = i.index(j) #prints the index of s
- f.append(man)
- output = 0
- for s in range(0,len(f)):
- output = output + f[s] #adds each index of s
- print(output)
- string = ['sigh','gsum']
- super_sum(string)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement