Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #A Super Sum Function
- def super_sum(list_of_strings):
- """This Function accepts a list of strings and return the sum of the index position of the first occurance of the letter "s" in each word"""
- total = 0
- for list_of_string in list_of_strings:
- if list_of_string.find("s") >= 0:
- total += list_of_string.find("s")
- return total
- words = ["mass", "maths", "success", "book", "greatest", "hello"]
- result = super_sum(words)
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement