Please conduct a python program following all instruction below….
Question Answered step-by-step Please conduct a python program following all instruction below…. Please conduct a python program following all instruction below. Problem Description:You are working for Twitter as a data analyst, and your manager has asked you to conduct an analysis of the effect of word length on the popularity of tweets. As part of the data preparation process, you need to identify all the “short” tweets. A short tweet, for purposes of this analysis, is defined as any tweet that has less words than the average word count of the tweets given to you. Your job is to create 3 functions. You must implement all 3 functions, since we will be testing all of them!:First, you will write tweet_length, which takes one parameter, a string that represents a tweet, and returns the number of words in that tweet.Second, you will write average_tweet_length, which takes one parameter, a list of strings representing each tweet, and returns the average word length of the list of tweets.Third, you will write get_short_tweets which takes one parameter, a list of strings representing each tweet, and returns the list of the “short” tweets.Note:You must implement all 3 functions since we will be testing all of them!To simplify the third function, make calls to the first two functions! We will be manually checking that you do this in your code!Example: In the following example, print_thunderbolt uses the function print_parallelogram and create_lineImage transcription textRun 1 ‘ print_thunderbolt uses the functions create_line 2 and print_parallelogram’ ‘ ‘ 3 4 def create_line(line_length) : 5 return “*” * line_length 6 7 def print_parallelogram(height, width) : 8 for i in range(height) : 9 print (” ” * i + create_line(width) ) # calls create_line 10 # ” ” * i ad… Show more… Show moreTest cases for tweet_length :Example 1:Argument passed to function:’fav places to study on campus. A thread:’ Function tweet_length returns:8 Explanation:There are 8 words in the tweet ‘fav places to study on campus. A thread:’NOTE: The dot (.) and the colon(:) are considered to be part of the words campus and thread respectively as there are no spaces between them. Example 2:Argument passed to function:’howdy!’ Function tweet_length returns:1 Explanation:There is 1 word in the tweet ‘howdy!’ Test cases for average_tweet_length :Example 1:Argument passed to function:[‘Apply to the job opportunity below. Looking for those fluent in Portuguese!’, ‘its snowing in austin!!!’, ‘erm’] Function average_tweet_length returns:5.666666666666667 Explanation:The length of each tweet is [12, 4, 1], so the average is (12 + 4 + 1) / 3 = 5.666666666666667. Example 2:Argument passed to function:[“Serena Williams does it again!!”, “Kim Yeon-koung receives the MVP”, “i support Simone’s mental-health break”]NOTE: The string “i support Simone’s mental-health break” has a single quote in it as part of the string. To be able to use single quotes within strings, we could enclose the string in double quotes. Function average_tweet_length returns:5.0 Explanation:The length of each tweet is [5, 5, 5], so the average is 5. Test cases for get_short_tweets :Example 1:Argument passed to function:[‘are u telling me a shrimp fried this rice?’, ‘Anyone see the new Marvel mvie?’, ‘beach vibez today’, ‘can we talk about the political and economic state of the world?’] Function get_short_tweets returns:[‘Anyone see the new Marvel mvie?’, ‘beach vibez today’] Explanation:Words per tweet: [9, 6, 3, 12]. Average is 7.5 words, so it returns any tweet less than 7.5 words ****Incorrect returned list****:[‘beach vibez today’, ‘Anyone see the new Marvel mvie?’]You must return the list of “short tweets” in the order that you found them in the original argument list. ‘Anyone see the new Marvel movie?’ comes before ‘beach vibez today’ in the argument. Example 2:Argument passed to function:[‘covfefe’, ‘hi!’, ‘YOLO’] Function get_short_tweets returns:[ ] (empty list) Explanation:Words per tweet: [1,1,1]. Average is 1 word, so it returns an empty list, since none of the tweets are shorter than the average word length. Example 3:Argument passed to function:[“Go Tritons!”, “stay hydrated at Sun God!”, “if i don’t have a yummy treat every couple of hours my condition worsens”, “finished writing my first novel!!”] NOTE: We are using double quotes (instead of single quotes) for the tweets in this case because one of the words in the third tweet has a single quotes in it (i.e., don’t). Function get_short_tweets returns:[‘Go Tritons!’, ‘stay hydrated at Sun God!’, ‘finished writing my first novel!!’] Explanation:Words per tweet: [2, 5, 14, 5]. Average is 6.5 words, so it returns any tweet less than 6.5 words ****Incorrect returned lists (there are more incorrect possibilities than ones described below)****:[‘finished writing my first novel!!’, ‘stay hydrated at Sun God!’, ‘Go Tritons!’][‘Go Tritons!’, ‘finished writing my first novel!!’, ‘stay hydrated at Sun God!’]You must return the list of “short tweets” in the order that you found them in the original argument list. Notes:Do not count punctuation as a word, and you can always assume that any punctuation will be right next to a word with no spaces in between.For example: ‘hello, my name is Chai!’ -> the “,” comes right after the word “hello” and the “!” comes right after “Chai”A valid argument is an empty list. If the argument is an empty list, you should return an empty list.The list of words you return must be in the order that you found them in the original argument list.Each tweet will contain at least one word Computer Science Engineering & Technology Python Programming CSE 8a Share QuestionEmailCopy link Comments (0)


