Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. # Define a procedure, measure_udacity,
  2. # that takes as its input a list of strings,
  3. # and returns a number that is a count
  4. # of the number of elements in the input
  5. # list that start with the uppercase
  6. # letter 'U'.
  7.  
  8.  
  9. def measure_udacity(stringList):
  10. count = 0
  11. for item in stringList:
  12. if item[0] == 'U':
  13. count += 1
  14. return count
  15.  
  16.  
  17. print measure_udacity(['Dave','Sebastian','Katy'])
  18. #>>> 0
  19.  
  20. print measure_udacity(['Umika','Umberto'])
  21. #>>> 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement