# 1. Try to guess the output first, and run the code to validate your guess a = "" len(a) b = "it's ok" len(b) c = 'it\'s ok' len(c) d = """hey""" len(d) e = '\n' len(e) # 2. There is a saying that "Data scientists spend 80% of their time cleaning data, and 20% of their time complaining about cleaning data." Let's see if you can write a function to help clean US zip code data. Given a string, it should return whether or not that string represents a valid zip code. For our purposes, a valid zip code is any string consisting of exactly 5 digits. # HINT: `str` has a method that will be useful here. Use `help(str)` to review a list of string methods. def is_valid_zip(zip_code): """ Returns whether the input string is a valid (5 digit) zip code """ pass # 3. A researcher has gathered thousands of news articles. But she wants to focus her attention on articles including a specific word. Complete the function below to help her filter her list of articles. #Your function should meet the following criteria #- Do not include documents where the keyword string shows up only as a part of a larger word. For example, if she were looking for the keyword "closed", you would not include the string "enclosed." #- She does not want you to distinguish upper case from lower case letters. So the phrase "Closed the case." would be included when the keyword is "closed" #- Do not let periods or commas affect what is matched. "It is closed." would be included when the keyword is "closed". But you can assume there are no other types of punctuation. def word_search(doc_list, keyword): """ Takes a list of documents (each document is a string) and a keyword. Returns list of the index values into the original list for all documents containing the keyword. Example: doc_list = ["The Learn Python Challenge Casino.", "They bought a car", "Casinoville"] >>> word_search(doc_list, 'casino') >>> [0] """ pass # 4. Dice may not have any memory, but apparently the roulette wheel at the Learn Challenge Casino does. You've received a tip-off that the wheel has some exploitable bias where the probability of landing on a given number changes depending on the number previously landed on. Analyze a list containing a history of roulette spins. #Return a dictionary where the keys are numbers on the roulette wheel, and the values are dictionaries mapping numbers on the wheel to probabilities, such that `d[n1][n2]` is an estimate of the probability that the next spin will land on n2, given that the previous spin landed on n1. def conditional_roulette_probs(history): """ Example: conditional_roulette_probs([1, 3, 1, 5, 1]) > {1: {3: 0.5, 5: 0.5}, 3: {1: 1.0}, 5: {1: 1.0} } """ pass