Mixed-Up Code Questions

Create a function called greeting_search that takes in a list of strings, lst, as a parameter and returns True if the list has “Good Morning!” in it and False otherwise. For example, greeting_search(["Hello!", "Good Morning!", "good morning!"]) should return True.

Write a function called greeting_search that takes in a list of strings, lst, as a parameter and returns True if the list has “Good Morning!” in it and False otherwise. For example, greeting_search(["Hello!", "Good Morning!", "good morning!"]) should return True.

Create a function called search_h that takes in a list of strings, lst, and uses regular expressions to add all the words starting with an “H” or an “h” to a new list and returns that new list. For example, search_h(["Hello!", "hello.", "Morning!", "hi"]) should return ['Hello!', 'hello.', 'hi'].

Write a function called search_h that takes in a list of strings, lst, and uses regular expressions to add all the words starting with an “H” or an “h” to a new list and returns that new list. For example, search_h(["Hello!", "hello.", "Morning!", "hi"]) should return ['Hello!', 'hello.', 'hi'].

Create a function called search_o that takes in a list of strings, lst, and uses regular expressions to add all the words that have a lowercase “o” to a new list and returns that new list. For example, search_o(['Hello', 'Good Morning!', 'hi']) should return ['Hello', 'Good Morning!'].

Write a function called search_o that takes in a list of strings, lst, and uses regular expressions to add all the words that have a lowercase “o” to a new list and returns that new list. For example, search_o(['Hello', 'Good Morning!', 'hi']) should return ['Hello', 'Good Morning!'].

Create a function called match_word(word, str) that returns True if the string str contains the word word, but not if it is part of another word. For example, match_word('is', "This was bad") would return False and match_word('is', "This is good") would return True.

Write a function called match_word(word, str) that returns True if the string str contains the word word, but not if it is part of another word. For example, match_word('is', "This was bad") would return False and match_word('is', "This is good") would return True.

Create a function called test_pattern that takes in one string parameter, sequence, and uses regular expressions to see if sequence has the pattern of at least one letter, number, or underscore, at least one space, and at least one letter, number, or underscore again. Return "Match!" if sequence matches the pattern, and "Not a match!" otherwise. For example, test_pattern('Sincerely1       Molly') should return "Match!".

Write a function called test_pattern that takes in one string parameter, sequence, and uses regular expressions to see if sequence has the pattern of at least one letter, number, or underscore, at least one space, and at least one letter, number, or underscore again. Return "Match!" if sequence matches the pattern, and "Not a match!" otherwise. For example, test_pattern('Sincerely1       Molly') should return "Match!".

Create a function called first_price that takes in a parameter string and uses regular expressions to find and return the first price in the string if there is one. A price must have at least one digit after a ‘$’ symbol and can optionally have a period followed by two digits. If there isn’t a price in the string, return 'No price'. For example, first_price('We just received $2098.10 for cookies and $209 for brownies.') should return "$2098.10".

Write a function called first_price that takes in a parameter string and uses regular expressions to find and return the first price in the string if there is one. A price must have at least one digit after a ‘$’ symbol and can optionally have a period followed by two digits. If there isn’t a price in the string, return 'No price'. For example, first_price('We just received $2098.10 for cookies and $209 for brownies.') should return "$2098.10".

Create a function called search_email that takes in a string parameter, string, and uses regular expressions to return a list with all the emails in the string. The format for the email is at least one letter, number or underscore, the “@” symbol, and the email domain (which includes a period). For example, search_email('His email is pyth_on@umich.edu and her email is java@css.') should return ['pyth_on@umich.edu'].

Write a function called search_email that takes in a string parameter, string, and uses regular expressions to return a list with all the emails in the string. The format for the email is at least one letter, number or underscore, the “@” symbol, and the email domain (which includes a period). For example, search_email('His email is pyth_on@umich.edu and her email is java@css.') should return ['pyth_on@umich.edu'].

Create a function called start_from` that takes in a list of strings, lst, and adds into a new list each item that starts with “From:” and is followed by one or more characters and an “@” sign. For example, start_from(['From: Kelly@umich.edu','From: Kelly@',': Kelly@']) should return ['From: Kelly@umich.edu', 'From: Kelly@'].

Write a function called start_from` that takes in a list of strings, lst, and adds into a new list each item that starts with “From:” and is followed by one or more characters and an “@” sign. For example, start_from(['From: Kelly@umich.edu','From: Kelly@',': Kelly@']) should return ['From: Kelly@umich.edu', 'From: Kelly@'].

Create a function called grab_domain that takes in a list of strings, lst, as a parameter and returns a new list with the domains of the emails, if they exist. For example, grab_domain(['python@umich.edu','This is Kelly@umich.gov','123','java@css','jav12a@css.com']) would return ['umich.edu', 'umich.gov', 'css.com'].

Write a function called grab_domain that takes in a list of strings, lst, as a parameter and returns a new list with the domains of the emails, if they exist. For example, grab_domain(['python@umich.edu','This is Kelly@umich.gov','123','java@css','jav12a@css.com']) would return ['umich.edu', 'umich.gov', 'css.com'].

Create a function called vowels_in_mid that takes in one string parameter, string, and returns string if there is an area in the string that contains two to four vowels, and it does not start nor end with a vowel. Otherwise, return 'Does not exist'. For example, vowels_in_mid('chEEEEEYYEErry') should return 'chEEEEEYYEErry'.

Write a function called vowels_in_mid that takes in one string parameter, string, and returns string if there is an area in the string that contains two to four vowels, and it does not start nor end with a vowel. Otherwise, return 'Does not exist'. For example, vowels_in_mid('chEEEEEYYEErry') should return 'chEEEEEYYEErry'.

You have attempted of activities on this page