In this assignment, you will design a simple word count Pythonprogram. A word count program is useful
Fantastic news! We've Found the answer you've been seeking!
Question:
In this assignment, you will design a simple word count Pythonprogram. A word count program is useful in word editor application.The program that receives a series of words from the user and keepcounting the number of words entered. The program allows the userto type ?-1? to indicate that s/he is finished providing inputs.After the user presses ?-1? key, the program prints the total wordcount. You are required to use while loop and conditionalstatements for this assignment.
Transcribed Image Text:
Topics: Input, Print, Variables, Conditional Structure, While Loop Problem Statement: Word Count The purpose of this assignment is to gain experience in python's conditional structure and while loop. Lab Scenario: In this assignment, you will design a simple word count program. A word count program is useful in word editor application. The program that receives a series of words from the user and keep counting the number of words entered. The program allows the user to type "-1" to indicate that s/he is finished providing inputs. After the user presses "-1" key, the program prints the total word count. You are required to use while loop and conditional statements for this assignment. Lab Procedure: 1. Prior starting of the work consider how to design the while loop: a. What would be the loop condition? b. What would be the stopping criteria? c. How to initialize the loop variable? 2. Determine how to calculate the word count. What is the variable to store the count and where to initialize the variable? Hint: define a variable named 'total_word', initialize it before while loop and keep incrementing the variable 'total_word'. Think about the right operator which keeps adding to a variable. 3. Test the application by hand-calculating several values and use the same values to validate the operation. Sample input/output: Enter alword or type '-1' to end the program: this Enter a word or type '-1' to end the program: is Enter a word or type '-1' to end the program: a Enter a word or type '-1' to end the program: test Enter a word or type '-1' to end the program: program Enter a word or type '-1' to end the program: -1 Word count: 5 Topics: Input, Print, Variables, Conditional Structure, While Loop Problem Statement: Word Count The purpose of this assignment is to gain experience in python's conditional structure and while loop. Lab Scenario: In this assignment, you will design a simple word count program. A word count program is useful in word editor application. The program that receives a series of words from the user and keep counting the number of words entered. The program allows the user to type "-1" to indicate that s/he is finished providing inputs. After the user presses "-1" key, the program prints the total word count. You are required to use while loop and conditional statements for this assignment. Lab Procedure: 1. Prior starting of the work consider how to design the while loop: a. What would be the loop condition? b. What would be the stopping criteria? c. How to initialize the loop variable? 2. Determine how to calculate the word count. What is the variable to store the count and where to initialize the variable? Hint: define a variable named 'total_word', initialize it before while loop and keep incrementing the variable 'total_word'. Think about the right operator which keeps adding to a variable. 3. Test the application by hand-calculating several values and use the same values to validate the operation. Sample input/output: Enter alword or type '-1' to end the program: this Enter a word or type '-1' to end the program: is Enter a word or type '-1' to end the program: a Enter a word or type '-1' to end the program: test Enter a word or type '-1' to end the program: program Enter a word or type '-1' to end the program: -1 Word count: 5
Expert Answer:
Answer rating: 100% (QA)
Python version 36 Python program to create a simple word count applica... View the full answer
Related Book For
Starting Out With Java From Control Structures Through Data Structures
ISBN: 9780133957051
6th Edition
Authors: Tony Gaddis
Posted Date:
Students also viewed these electrical engineering questions
-
In this assignment you are going to prepare payroll accounting entries, complete payroll records, and prepare payroll tax returns for a Company that started operations on October 1 of the current...
-
In this Assignment you examine the target customer using your CSR Tool Belt including the life stages of the targeted customer. The better you are at understanding who the targeted customer is, the...
-
In this Assignment you will create a class that represents a Social Media profile (like a Facebook profile many of you have). The name of this class will be SocialMediaProfile . There are many things...
-
96. A 66-year-old woman with a long history of heavy smoking presents to her doctor with complaints of shortness of breath and chronic coughing that has been present for about 2 years and has been...
-
Refer to the information reported about Taurasi Company in Problem 16-4B. Required Prepare a complete statement of cash flows using a spreadsheet as in Exhibit 16A.1; report operating activities...
-
One of the authors and some statistician friends have an ongoing series of Euchre games that will stop when one of the two teams is deemed to be statistically significantly better than the other...
-
The December 1, bank statement of Billys Hamburger just arrived from Safety Bank. To prepare the bank reconciliation, you gather the following additional data: a. The following checks are outstanding...
-
Answer the questions below for assets A to D shown in the table. Asset Beta A ...... 0.50 B ...... 1.60 C ...... 0.20 D ...... 0.90 a. What impact would a 10% increase in the market return be...
-
1. What are the three levels of planning? 2. What do you understand by aggregate planning? What level of planning does it represent? 3. What are some challenges of aggregate planning? 4. Describe the...
-
V. N. Murti and V. K. Sastri investigated the production characteristics of various Indian industries, including cotton and sugar. They specified CobbDouglas production functions for output (Q) as a...
-
Calculate the missing amounts. Net sales Cost of goods sold Gross profit from sales Operating expenses Profit (loss) b $ 207,600 $ 162,600 $ 72,600 41,200 a 107,400 91,200 92,200 (31,800) C (6,300)...
-
Let T: R R be a mapping defined by T(x, y, z)=(3x-5y, 2x + z) 1. Is T a linear transformation? Verify your answer? 2. Find [T] the standard matrix that represents T ? 4 3. Find T( -1 |)? -3
-
Culture" impact the course of hominid evolution. how did the changing cultural behavior of early Homo influence biological evolution, resulting in modern Homo sapiens? Make sure that you include two...
-
Example 4: Let f(x)= log(x-4x+7)-log(x+3). What are all the values of x for which f(x)>0? Example 5: Let g(x) = In(x+x-5) and let h(x)= In(x+4). What are all values of x for which g(x)
-
USSubCo is a United States C Corporation that is wholly owned by AwayCo, a company incorporated in country F . Country F has a tax treaty with the United States similar to the United States Model...
-
Let: A= -3 -5 10 12 a) Find the eigenvalues and eigenvectors of A: The smaller eigenvalue is A = with associated eigenvector X1 == The larger eigenvalue is A = with associated eigenvector X2 b) Find...
-
help with this code in java Given two strings, word and a separator sep, return a big string made of count occurrences of the word, separated by the separator string. repeatSeparator ("Word", "X", 3)...
-
Describe basic managerial approaches to implementing controls and how these are implemented.
-
What is the purpose of testing a program with sample data or input?
-
What is the difference between an input file and an output file?
-
Is encapsulation a characteristic of procedural or object-oriented programming?
-
A square chip of size \(8 \mathrm{~mm}\) is mounted on a substrate with the top surface being exposed to a coolant flow at \(20^{\circ} \mathrm{C}\). All other surfaces of the chip are insulated. The...
-
Derive the energy balance equation for a rectangular fin of variable crosssection as shown in Figure 1.6. The fin is stationary and is attached to a hot heat source.
-
A closed plastic container used to serve coffee in a seminar room is made of two layers with an air gap placed between them. List all heat transfer processes associated with the cooling of the coffee...
Study smarter with the SolutionInn App