Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. #A Super Sum Function
  2. def super_sum(list_of_strings):
  3.     """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"""
  4.     total = 0
  5.     for list_of_string in list_of_strings:
  6.         if list_of_string.find("s") >= 0:
  7.             total += list_of_string.find("s")
  8.     return total
  9.    
  10. words = ["mass", "maths", "success", "book", "greatest", "hello"]
  11. result = super_sum(words)
  12. print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement