Lab Assignment Prompt: News Editor-in-Chief
As the news editor, who also happens to have some Python skills, your role requires a weekly review of your reporters’ work and make sure it communicates clearly to your audience. Some of this work is repetitive - especially finding those words and phrases that authors tend to frequently reuse.
To save yourself some time, and improve complete the weekly review faster, you will create a python program to:
• Inspect a text document provided by any author/reporter.
• Count the number of times each word appears in the text. (Common articles, such as a, an, the, may be ignored)
• Search for a specific word and replace it with something different.
• Open a file, operate upon, and save a new version of, a text file stored locally on your computer.
NOTE: Run ALL of the code you created and make sure it works as intended (WAI).
Program Requirements:
Import a document
● Count the number of total words in the document.
○ Unit 1: Numeric operations
○ Unit 2: Variables
● Count the number of each word in the document and store the word and its count in a dictionary, with the word as the Key and the count as the Value.
○ Unit 6: Dictionaries
○ Unit 5: Loops
○ Unit 2: Assignments and shortcut operators
○ Unit 2: Variables
○ Unit 1: Numeric operations
○ NOTE: this requirement is basically the dictionary counting trick.
Assignment continues on the following page.
● Include a way to exclude common but unimportant words, such as “a”, “an”, “the”. The user of your code can input a list of these unimportant words and there can be as many as the user would like to ignore.
○ Unit 4: Lists
○ Unit 3: Functions (optional parameters)
○ Unit 5: Loops
○ Unit 6: Dictionaries, Keys, looping through keys using list elements
● Store a second dictionary with each word’s proportion as a float with four decimals, of the text’s total words. For example, if the word, “weather” is found 143 times out of 5390 total words, the proportion will be calculated as 143 / 5390, and the value will be 0.0265.
○ Unit 6: Dictionaries
○ Unit 5: Loops
○ Unit 2: Assignments
○ Unit 2: Variables
○ Unit 1: Numeric operations
○ NOTE: this requirement is basically a twist on the dictionary counting trick, so students can’t just copy the counting trick. But they can get close to this.
● Accept a user’s query of whether a word exists in the text. If the word search finds a word, state the word, the number of times it appears, and the proportion of total words made up by that word. If the word does not find the word, return some information that the word was not found in the text.
○ Unit 6: Dictionaries – using Key In / Not In
○ Unit 4: Lists – using In / Not In
○ Unit 6: Dictionaries – basic call of a K/V pair
○ Unit 2: Conditional Statements
● Accept a user’s request to list the top n words in the text. (The user chooses how many.) The code will print the word, the absolute count, and the proportion of those words - each on its own line.
○ Unit 6: Dictionaries
○ Unit 4: Lists (possibly, to extract the list of keys from a dictionary and slice the top n)
○ Unit 2: Conditional Statements
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme