Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Define a procedure, measure_udacity,
- # that takes as its input a list of strings,
- # and returns a number that is a count
- # of the number of elements in the input
- # list that start with the uppercase
- # letter 'U'.
- def measure_udacity(stringList):
- count = 0
- for item in stringList:
- if item[0] == 'U':
- count += 1
- return count
- print measure_udacity(['Dave','Sebastian','Katy'])
- #>>> 0
- print measure_udacity(['Umika','Umberto'])
- #>>> 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement