OsahonE

Wk4_6

Mar 31st, 2020
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. def super_sum(list):
  2.     total = 0
  3.  
  4.     '''Iterating over each value in the list,
  5.     and adding the indexes of the first
  6.     occurrence of the letter "s", we have:'''
  7.    
  8.     for values in list:
  9.              total += values.index("s")
  10.              # total = total + values.index("s")
  11.     return total
  12.        
  13. print(super_sum(["mustache", "greatest"]))
  14. print(super_sum(["mustache", "greatest", "almost"]))
Add Comment
Please, Sign In to add comment