Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 2 ( 1 . 5 pts ) For loop The following are words taken from two pieces of news: News 1 from CBS: 'TikTok',
Question pts For loop The following are words taken from two pieces of news: News from CBS: 'TikTok', 'users', 'soon', 'find', 'popular', 'social', 'media', 'service', 'either', 'under', 'new', 'ownership', or 'although', "wouldn't", 'happen', 'immediately', 'outright', 'ban', inUS On 'Saturday, 'House', 'passed', 'legislation', 'would', 'ban', 'TikTok', 'from', 'operating', in USif 'popular', "platform's", 'Chinabased', 'owner', "doesn't", 'sell', 'stake', 'within', 'year', 'The', 'bill', 'will', 'next', 'head', 'Senate', 'where', 'expected', 'pass', 'buoyed', 'attachment', 'larger', 'foreign', 'aid', 'package', 'for', 'for', 'Ukraine', 'Israel', 'gained', 'bipartisan', 'support' News from CNN: 'Foreshadowing', 'legal', 'strategy', 'TikTok', 'already', 'publicly', 'opposed', 'bill', asan 'infringement', on 'users 'First', 'Amendment', 'rights', 'Supporters', of 'legislation', 'contrast', 'have', 'said', 'necessary', 'measure', 'protect', 'Americans 'personal', 'data', 'have', 'pushed', 'back', on 'characterizations', ofas 'flatout', 'ban', 'Some', 'legal', 'experts', on 'First', 'Amendment', 'have', 'suggested', 'TikTok', 'ban', 'have', 'case', 'noting', 'courts', 'have', 'tended', 'look', at 'ultimate', 'impacts', ofof 'challenged', 'laws', on 'Americans 'speech', 'not', 'just', 'their', 'stated', 'intent' Write a program to do the following: Create two lists to hold the words from the two news and use a for loop to convert all words to lower case. Hint: use enumerate function and lower method Use a for loop to remove all stop words from the two lists and output number of words left. Stop words are: 'under', inon 'from', 'the', 'for', asanofat 'have' Use a for loop to create a dictionary of word frequency of all unique words used in the combined words list. Optional Extra Credit Find the most frequently mentioned words
Question pts For loop
The following are words taken from two pieces of news:
News from CBS:
'TikTok', 'users', 'soon', 'find', 'popular', 'social', 'media', 'service', 'either', 'under', 'new',
'ownership', or 'although', "wouldn't", 'happen', 'immediately', 'outright', 'ban', inUS
On 'Saturday, 'House', 'passed', 'legislation', 'would', 'ban', 'TikTok', 'from', 'operating', in
USif 'popular', "platform's", 'Chinabased', 'owner', "doesn't", 'sell', 'stake', 'within', 'year',
'The', 'bill', 'will', 'next', 'head', 'Senate', 'where', 'expected', 'pass', 'buoyed', 'attachment', 'larger',
'foreign', 'aid', 'package', 'for', 'for', 'Ukraine', 'Israel', 'gained', 'bipartisan', 'support'
News from CNN:
'Foreshadowing', 'legal', 'strategy', 'TikTok', 'already', 'publicly', 'opposed', 'bill', asan
'infringement', on 'users 'First', 'Amendment', 'rights', 'Supporters', of 'legislation',
'contrast', 'have', 'said', 'necessary', 'measure', 'protect', 'Americans 'personal', 'data', 'have',
'pushed', 'back', on 'characterizations', ofas 'flatout', 'ban', 'Some', 'legal', 'experts', on
'First', 'Amendment', 'have', 'suggested', 'TikTok', 'ban', 'have', 'case', 'noting', 'courts', 'have',
'tended', 'look', at 'ultimate', 'impacts', ofof 'challenged', 'laws', on 'Americans 'speech',
'not', 'just', 'their', 'stated', 'intent'
Write a program to do the following:
Create two lists to hold the words from the two news and use a for loop to convert all
words to lower case. Hint: use enumerate function and lower method
Use a for loop to remove all stop words from the two lists and output number of words
left. Stop words are: 'under', inon 'from', 'the', 'for', asanofat 'have'
Use a for loop to create a dictionary of word frequency of all unique words used in the
combined words list.
Optional Extra Credit
Find the most frequently mentioned words
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started