Question: Language: python . Problem 3: Write a function findemail(url) that takes as input a URL, and outputs any email addresses that look like xxxxXX.XXX.XXX with


Language: python
. Problem 3: Write a function findemail(url) that takes as input a URL, and outputs any email addresses that look like "xxxxXX.XXX.XXX" with any number of dots after the @-sign on this page. The order of the email addresses in the output doesn't matter. Your function should also get around tricks people use to hide their email addresses, such as hangjie@math.ucla.edu hangjie AT math DOT ucla DOT edu hangjie at math dot ucla dot edu hangjie[AT] ucla[DOT] edu hangjie[at] ucla(dot)edu Test cases: url1 = "https://www.math.ucla.edu/"hangjie/contact/" url2 = "https://www.math.ucla.edu/"hangjie/teaching/Winter 2019PIC16/regexTest" findemail(url1) should return ["hangjie@math.ucla.edu"); findemail(ur12) should return ("hangjie1@math.ucla.edu", "hangjie2@math.ucla.edu", "hangjie3@math.ucla.edu", "hangjie4@ucla.edu", "hangjie5@ucla.edu", "xxx@xxx.xxx.xxx"). Write a function happiness (text) that uses the Dodds et al (1) happiness dictionary to rate the happiness of a piece of english text input as a single string). The happiness score is the average score over all words in the text that appear in the dictionary. For simplicity, you may neglect the words with special characters in the dictionary. Test cases: s1 = "Mary had a little lamb." 82 = "Mary had a little lamb. Mary had a little lamb!" s3 = "A quick brown fox jumps over a lazy dog." happiness (81) and happiness (82) should return 5.368; happiness (83) should return 5.275. . Problem 3: Write a function findemail(url) that takes as input a URL, and outputs any email addresses that look like "xxxxXX.XXX.XXX" with any number of dots after the @-sign on this page. The order of the email addresses in the output doesn't matter. Your function should also get around tricks people use to hide their email addresses, such as hangjie@math.ucla.edu hangjie AT math DOT ucla DOT edu hangjie at math dot ucla dot edu hangjie[AT] ucla[DOT] edu hangjie[at] ucla(dot)edu Test cases: url1 = "https://www.math.ucla.edu/"hangjie/contact/" url2 = "https://www.math.ucla.edu/"hangjie/teaching/Winter 2019PIC16/regexTest" findemail(url1) should return ["hangjie@math.ucla.edu"); findemail(ur12) should return ("hangjie1@math.ucla.edu", "hangjie2@math.ucla.edu", "hangjie3@math.ucla.edu", "hangjie4@ucla.edu", "hangjie5@ucla.edu", "xxx@xxx.xxx.xxx"). Write a function happiness (text) that uses the Dodds et al (1) happiness dictionary to rate the happiness of a piece of english text input as a single string). The happiness score is the average score over all words in the text that appear in the dictionary. For simplicity, you may neglect the words with special characters in the dictionary. Test cases: s1 = "Mary had a little lamb." 82 = "Mary had a little lamb. Mary had a little lamb!" s3 = "A quick brown fox jumps over a lazy dog." happiness (81) and happiness (82) should return 5.368; happiness (83) should return 5.275
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
