Lab: Practice Problems II

More function definitions

No Google! The point of this exercise is to see how well you understand the material. Treat it like an exam - this is not the time to be googling answers. Once you've completed this "exam", then you should look up solutions and compare.

Copy this into a Python file and add the specified code under each comment. For testing purposes, you can comment out working parts as you go (surround the lines with """).

"""
This is how you comment
out a whole block of stuff.
"""
# define a function that takes a list of numbers and an integer x and returns
#  the count of numbers that are larger than x


# define a function that tests the above function.



# define a function that takes a list of words and returns the acronym for it
#  (i.e. the first letter in each word, so ["cat", "bat", "rat"] would return "cbr")
# hint: remember that strings are sequences, just like lists


# define a function that tests the above function.



# define a function that takes a list of integers and asks the user for an integer
#  in that list. Keep asking until they give you one that is in the list, then return
#  that number. (e.g. if the list is [1,4,5], keep asking for an integer until they type
#  1, 4 or 5, then return that number.)


# define a function that tests the above function.



# define a function that takes two lists and returns the intersection of them
# (the intersection is the list of numbers that are in both lists)
# (do not use the built-in Python set intersection method)


# define a function that tests the above function.