Advertisement
dprincef

Untitled

Feb 22nd, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. def super_sum(string): #declares the function super_sum
  2.     f = [] #stores the index of s
  3.     for i in string:
  4.         for j in i:
  5.             if j == 's':
  6.                 man = i.index(j) #prints the index of s
  7.                
  8.                 f.append(man)
  9.  
  10.     output = 0
  11.     for s in range(0,len(f)):  
  12.         output = output + f[s]     #adds each index of s    
  13.     print(output)    
  14. string = ['sigh','gsum']
  15. super_sum(string)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement