Write a Python program to get a string from the user, and count the number of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Python program to get a string from the user, and count the number of letters (a-z or A- Z), digits (0-9), spaces, and other characters. The prompt should be "Please enter a string: " The output should be formatted as "There are {:d) letters, {:d) digits, (:d) spaces, and (:d) other characters. The length of the string is (:d)." NOTE: you should strictly follow the prompt/output format to get full marks. Example1 (The contents highlighted by brown ink are inputs from the user): Please enter a string: I have a keyboard with 87 keys. There are 22 letters, 2 digits, 6 spaces, and 1 other characters. The length of the string is 30. Example2 (The contents highlighted by brown ink are inputs from the user): Please enter a string: Nothing is impossible There are 19 letters, 0 digits, 2 spaces, and 0 other characters. The length of the string is 21. Write a Python program to get a string from the user, and count the number of letters (a-z or A- Z), digits (0-9), spaces, and other characters. The prompt should be "Please enter a string: " The output should be formatted as "There are {:d) letters, {:d) digits, (:d) spaces, and (:d) other characters. The length of the string is (:d)." NOTE: you should strictly follow the prompt/output format to get full marks. Example1 (The contents highlighted by brown ink are inputs from the user): Please enter a string: I have a keyboard with 87 keys. There are 22 letters, 2 digits, 6 spaces, and 1 other characters. The length of the string is 30. Example2 (The contents highlighted by brown ink are inputs from the user): Please enter a string: Nothing is impossible There are 19 letters, 0 digits, 2 spaces, and 0 other characters. The length of the string is 21.
Expert Answer:
Answer rating: 100% (QA)
Python Get a string from the user inputstring inputPlease en... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Your first assignment was to enter forecasting data. How will SAP use this information?
-
Morgan-Hunt Agency, a financial investment company, pays $300 to each of its salespersons as a year-end bonus, regardless of productivity. This is an example of a(n) Discuss in details.
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
For the non-seasonal frequencies, use \(g \operatorname{lm}()\) to fit the additive exponential model \[ E\left(|\hat{Y}(\omega)|^{2}ight)=\beta_{0}+\beta_{1} \exp \left(-|2 \pi \lambda \omega|^{1 /...
-
An experiment consists of selecting a letter at random from the alphabet. Find the probability that the letter selected (a) Precedes G alphabetically. (b) Is a vowel (A, E, I, O, or U). (c) Precedes...
-
A location analysis for Temponi Control, a small manufacturer of parts for high-technology cable systems, has been narrowed down to four locations. Temponi will need to train assemblers, testers, and...
-
During the audit of the financial statements of Amis Manufacturing, Inc., the company's president, R. Alderman, and E. K. Luddy, the auditor, reviewed matters that were supposed to be included in a...
-
The budget director of Ginger's Florist has prepared the following sales budget. The company had $300,000 in accounts receivable on July 1. Ginger's Florist normally collects 100 percent of accounts...
-
A solenoid consists of 250 loops where each loop has an area A = 1.50 cm2 and the length of the solenoid is L = 12.0 cm. If the solenoid has a current I = 0.500 A, what is the magnitude of the...
-
Consider the three-variable linear programming problem shown in Fig. 5.2. (a) Construct a table like Table 5.4, giving the indicating variable for each constraint boundary equation and original...
-
(a) Define partial derivatives for function of two variables. Why do you use partial derivatives? For the function f(x, y) = 2z (x, y?) respectively. 1 I'y-ry find fr(x, y) and fy(x,y) at the points...
-
Write a sales message to Better Horizons members to promote the new rewards programs. Feel free to add additional details (i.e., types of rewards). Christine Russo works at Better Horizons and is...
-
Write a sales message to Better Horizons members to promote the financial planning cruise. Feel free to add additional details (i.e., price and dates for the cruise). Christine Russo works at Better...
-
Choose a company and analyze its corporate citizenship measures. In four to five paragraphs, explain the companys major corporate citizenship initiatives and how they reflect its core values....
-
Assume the role of Christine and write a letter to the board describing your ideas for the financial planning cruise and the new rewards program. Christine Russo works at Better Horizons and is...
-
Assume you own a computer retail store located near your campus (give the store any name you want). You have sold fewer PCs in recent years due to the strong demand for Macs among university...
-
In the "simple pendulum" experiment the period T was related to the length L and the gravitational constant g via T = 2T 1. Using error propagation rules, write an algebraic equation for the...
-
Uniform electric field in Figure a uniform electric field is directed out of the page within a circular region of radius R = 3.00 cm. The magnitude of the electric field is given by E = (4.50 x 10-3...
-
Give an example of a benign race conditionone whose outcome affects program behavior, but not correctness.
-
Prove that regular expressions and left-linear grammars are equally powerful. A left-linear grammar is a context-free grammar in which every right-hand side contains at most one nonterminal, and then...
-
In Section C 13.5.3 we described the semantics of a terminate arm on an Ada select statement: this arm may be selected if and only if all potential communication partners have terminated, or are...
-
Does the fact that selling is included as part of the promotional mix weaken or strengthen its role as a sub-element of marketing?
-
Discuss the role and function of selling.
-
Comment on why the proposed changes to sales processes are necessary. Also, which changes would you recommend in terms of their: (a) selling activities? (b) sales value proposition?
Study smarter with the SolutionInn App