In this exercise we will practice using loops to handle collections/containers. Your job is to write a program that asks the user to enter a sentence, then it counts and displays the occurrence of each letter.
Note: your program should count the letters without regard to case. For example, A and a are counted as the same.
Here is a sample run:
Enter a sentence: It's a very nice day today!
a: 3 times
c: 1 times
d: 2 times
e: 2 times
i: 2 times
n: 1 times
o: 1 times
r: 1 times
s: 1 times
t: 2 times
v: 1 times
y: 3 times
Notes:
The purpose of this problem is to practice using loops and collections/containers/strings.
Please make sure to submit a well-written program. Good identifier names, useful comments, and spacing will be some of the criteria that will be used when grading this assignment.
This assignment can be and must be solved using only the materials that have been discussed in class: loops, the index system, strings, lists and/or dictionaries. Do not look for or use alternative methods that have not been covered as part of this course.
How your program will be graded:
correctness: the program performs calculations correctly: 40%
complies with requirements (it properly uses loops, and containers/strings): 40%
code style: good variable names, comments, proper indentation and spacing : 20%
Language is python 3

Answers

Answer 1

Answer:

In Python:

chars = 'abcdefghijklmnopqrstuvwxyz'

letter = input("Sentence: ")

for i in range(len(chars)):

   count = 0

   for j in range(len(letter)):

       if chars[i] == letter[j].lower():

           count = count + 1

   if count > 0 :

       print(chars[i]+": "+str(count)+" times")

Explanation:

This initializes the characters of alphabet from a-z

chars = 'abcdefghijklmnopqrstuvwxyz'

This prompts the user for sentence

letter = input("Sentence: ")

This iterates through the initialized characters

for i in range(len(chars)):

This initializes count to 0

   count = 0

This iterates through the input sentence

   for j in range(len(letter)):

This compares the characters of the sentence with alphabet a-z

       if chars[i] == letter[j].lower():

If there is a match, count is incremented by 1

           count = count + 1

If there is an occurrence of character,

   if count > 0 :

The character and its count is printed

       print(chars[i]+": "+str(count)+" times")

Answer 2

In this exercise we have to use the knowledge of computational language in Python, so we have that code is:

It can be found in the attached image.

So, to make it easier, the code in Python can be found below:

chars = 'abcdefghijklmnopqrstuvwxyz'

letter = input("Sentence: ")

for i in range(len(chars)):

  count = 0

  for j in range(len(letter)):

      if chars[i] == letter[j].lower():

          count = count + 1

  if count > 0 :

      print(chars[i]+": "+str(count)+" times")

See more about python at brainly.com/question/26104476

In This Exercise We Will Practice Using Loops To Handle Collections/containers. Your Job Is To Write

Related Questions

How does Windows operating system manage the file?​

Answers

Answer:

The OS allows you to organize the contents of your computer in a hierarchical structure of directories that includes files, folders, libraries, and drives. Windows Explorer helps you manage your files and folders by showing the location and contents of every drive, folder, and file on your computer.

Is the quote "Stay inside and have water and food ready in case power goes out" a definition of...

A. Thunderstorm
B. Winter storm

Answers

Answer:

winter storm

Explanation:

possibility of a snow-in.

Answer: winter storm

In order to ask for user for input in store the results as a stream, you should use the function. Readline, readlnt, string, algorithm

Answers

Answer: String

-DoggyMan5

“A school is looking to build a new 30 desktop PC computer suite. The school has limited funds available. The PCs will have a lot of different software installed as well as an operating system and multiple students’ profiles.” [6 marks]

Answers

Answer:

it depend on the software the computer has along with how much data it can hold

Explanation:

Answer:

Depends on the software code the computer has

Explanation:

Josh wrote the following e-mail to his co-worker. PLEASE HELP QUWICK



i need the figues to enter them into my DBA presentation. ASAP. please send.

This is an example of _____.


effective communication

nonverbal communication

ineffective communication

workplace communication

Answers

Answer:

Answer choice 4

Explanation:

If Josh sends an e-mail to his... co-worker.... wouldn't that be... workplace communication?

D because he is sending a email to his coworker making it workplace communication

There are several possible reasons why a high percentage of IT projects are abandoned-the business strategy changed, technology changed, the project was not going to be completed on time or budget, the project sponsors responsible did not work well together, or the IT strategy was changed to cloud or SaaS.

a. True
b. False

Answers

Answer:

a. True

Explanation:

The above listed information are part of the reasons why so many IT projects are abandoned by the business entities after a given period of time frame.

You want to substitute one word with another throughout your
document. What tool(s) should you use?
O Cut and Paste
O Dictionary
O Find and Replace
O Copy and cut

Answers

I’m pretty sure it’s “Find and paste”

Suppose we want to prove the statement S(n): "If n ⥠2, the sum of the integers 2 through n is (n+2)(n-1)/2" by induction on n. To prove the inductive step, we can make use of the fact that 2+3+4+...+(n+1) = (2+3+4+...+n) + (n+1) Find, in the list below an equality that we may prove to conclude the inductive part.

a. If n ⥠3 then (n+2)(n-1)/2 + n + 1 = (n+3)(n)/2
b. If n ⥠1 then (n+2)(n-1)/2 + n + 1 = (n+3)(n)/2
c. If n ⥠2 then (n+2)(n-1)/2 + n + 1 = (n+3)(n)/2
d. If n ⥠1 then (n+2)(n-1)/2 + n + 1 = n(n+3)/2

Answers

Answer:

The answer is "Choice c".

Explanation:

Please find the complete question in the attached file.

To begin with, allow its principle of the numerically solving to be recognized, three stages are concerned.

1. Topic n=1

2. Suppose n to be true

3. Display n+1 it retains

We have LHS as 2+3+ for the third step now [tex](n+1) = (2+3+.. \& n) + n+1[/tex]

We can now replace the bracket of RHS by [tex]\frac{(n+2)(n-1)}{2},[/tex]as we assumed its valid for n in step 2

if we do that we get

[tex]= \frac{(n+2)(n-1)}{2+(n+1)}\\\\= \frac{(n^2-n+2n-2+2n+2)}{2}\\\\= \frac{(n^2+3n)}{2}\\\\= \frac{n(n+3)}{2}[/tex]

A keyboard would be considered _____. Select 2 options.

Answers

Answer:

What are the 2 options?

Explanation:

Answer:

Do you have the options?

Explanation:

Select four examples of fluid or pneumatic power systems.
crane
dentist's chair
barber's chair
bulldozer
calculator
wheelchair

Answers

Crane and barbers chair

Which of the following items are present in the function header?

A. function name and parameter (variable) list

B. parameter (variable) list

C. return value

D. function name

Answers

Where is the function header you speak of ?
Variable list. Variables always come first

Pls help I will thx and give points

Answers

Answer:

Desktop

Explanation:

A tablet and smartphone dont have enough storage like a desktop, so they would edit very efficiently

A desktop. A desktop has more advanced features than a tablet or smartphone. More programs are available and storage is more widely available as well

The science of how an object reacts to its motion through air is called _______________. (12 letters)
HURRY!!!

ANSWER CORRECTLY AND YOULL GET BRAINLIEST

Answers

Explanation:

friction drag that is your answer 12 letters

Answer:

drag

Explanation:

im not the brightest but in the sentients it should have "drag" in it but u can listen to others answers to make sure

Devising a plan to solve a problem or perform a task using a set of step by step instructions is called:
Running a program
Writing an algorithm
Creating syntax
Interpreting instructions

Answers

d becaus ig is following INSTRUCTIONS

Pls help I will give points

Answers

Answer:

Laptop

Explanation:

To have integrity means that you

Answers

You are honest and disciplined

Pls help me awnser this I will give points

Answers

Answer:

first one is "int" second one is "string" and third one should be "float"

Explanation:

not sure if the first one is right but try this.

What do you call the parts of the motor that do not move?.

Answers

Answer:

The stator..?

Explanation:

Stators are the stationary parts of motors. Dunno if I'm right lol

How does critical thinking relate to peer
assessment ?

Answers

Answer:

It both helps you understand very well on whatever assessments reading you do. You think and you pay 100% to your work and get done with it. You think through whatever you've been working on.

jeff has just upgraded from windows 7 to windows 10 and he is confused. He has started several universal apps but he can't figure out how to close them. how would you explain the process for closing a universal app?

Answers

Answer: Find the app you want to close, then go to the moveable panel and click the X.

How does the pay for many Science, Technology, Engineering, and Mathematics workers compare to the overall median for all careers? It is far lower than the overall median. It is far higher than the overall median. It is slightly higher than the overall median. It is about the same as the overall median.

Answers

Answer:

B

Explanation:

It just is

Answer:

B is correct

Explanation:

(15) You are a Pascal teacher (a very good programmer using assembly language(i.e., machine language) of your local machine). You are given only the following programmes:(at) A compiler written in P-code: translate a program in Pascal to one in P-code(P-code is very close to your local machine language).(b) A P-code interpreter written in Pascal: able to interpret any program writtenin P-code.a) (10) What will you do (with minimal effort) to run the Pascal programs yourstudents submit on your local machine

Answers

If you Could out A B C D separate that would help

Why do we use return statements? Choose all that apply

A.
Javascript requires functions to have return values.

B.
To return multiple data types simultaneously

C.
To allow a function to give different values depending on input.

D.
So that we no longer have to use console.log();

E.
To save the result of a function in a variable in other functions

Answers

Answer:

A.

Javascript requires functions to have return values.

How does a Red Team vs Blue Team exercise help an organization

Answers

Answer:

Kindly check explanation

Explanation:

The Red team VS Blue team exercise can be explained as a simulated form of exercise or challenge which is intentionally triggered by an organization in a bid to test and access its level of security in other to stay in top of an actual external threat that might be perpetrated. In the simulated exercise, the red team act as the attacker by deploying several forms of threats which are used by actual attackers. The blue team on the other hand act as guard to repel tune attack. All these helps organizations to detect possible weaknesses and loopholes in their system which they can improve on in other to promote system and information security.

6. What is a search engine?
a program that searches engines
a web site that searches anything
a hardware component
a machinery engine that search data

Answers

It is a web site that searches anything

Answer:

It is a web site that searches anything, the guy above me was Correct EDGE 2022!

Explanation:

А ______
network is good for connecting computers over boundaries.
campus area
local area
wide area
system area

Answers

Answer:

wide area network (WAN)

Explanation:

Answer: B. Local area

A local area network is good for connecting computer clusters

In the binary system, 1 and 0 are not known as digits. Instead, they are called
bits
switches
flow
variables
decimals​

Answers

Answer:

Variables

Explanation:

I hope it helps

Answer:

C variables

Explanation:

EASY What does the Backspace key do?

O Inserts characters behind (or to the left of) the insertion
point.
O Removes characters behind (or to the left of) the insertion
point.
O Removes characters in front of (or to the right of) the
insertion point
O Inserts characters in front of (or to the right of) the insertion
point.

Answers

Answer:

Removes characters behind (or to the left of) the insertion point.

Explanation:

besides earning money why do people work​

Answers

Answer:

to make a name for themselves

Explanation:

besides earning money some people actually enjoy their job and do it simply because they like it others do it because they genuinely want to help people for example, people who work in the medical field who actually care abt their patients

Count operation Lucky twos
Lucky Twos determines and displays the number of digits that are 2s in a whole number. For example, the number of 2s in 3487 is 0, while the number of 2s in 272521 is 3. Note: whole numbers are non-negative integers starting at zero 0, 1, 2, 3, 4.
Assume that the fractional part is discarded in the division:
10 / 4 = 2
8 / 5 = 1
20 / 3 = 6
Read number
set count to 0
while number > 0
If the number module 10 is Then add
1 to count
End If
Compute number as number / 10
End while
Display count.
Let n be the number of digits of the whole number. What is the number of operations that are executed in the code in terms of n?

Answers

Answer:

Following are the solution to this question:

Explanation:

Its complexity of both the pseudo-code described is indeed proportional to the number of digits. So, how often number there are in this specific number is the query. Whenever a number is considered, the d digit would be between [tex]10^{(d-1)}.[/tex] inclusive exclusive [tex]10^d[/tex] That would be as, let d become the number of digits at N, and the inequalities, They can tell

[tex]10^{(d-1)} \leq N < 10^d[/tex]

We get, we take a logarithm,

[tex]d-1 \leq \log(N) < d[/tex]

The increase of 1 to the left inequality, [tex]d \leq \log(N)+1[/tex], and Combining the previous outcome, we got, [tex]\log(N) < d \leq \log(N) + 1[/tex]. That's would be to say, that number of number d by [tex]O(\log(N))[/tex] is higher and lower. Consequently, the number of transactions in the code is [tex]O(\log(N))[/tex]

We have that the number of operations that are executed in the code in terms of n  is mathematically given as

The quantity of operations done in the code is O(log(N))

Operation

Generally the equation for the   is mathematically given as

If we think about a number,

with d digits is between 10^(d-1) inclusive and 10^d exclusive.

Let d be the wide variety of digits in N

10^(d-1) <= N < 10^d

d-1 <= log(N) < d

d <= log(N) + 1,

The Inequality

log(N) < d <= log(N) + 1.

Therefore

The quantity of operations done in the code is O(log(N))

For more information on Inequality visit

https://brainly.com/question/19491153

Other Questions
Which of the following statements is true of radiation but not of convection or conduction?A. It can occur beneath Earth's surface.B. It can occur beyond Earth's atmosphere.C. It can cause a liquid to get warmer.D. It can cause a solid to get warmer. In the following scenario, what is one thing about child development that the activity director may not have taken into account?A recreational program serves children in grades one through five. An activity director is trying to build children's strength. He decides that all children will work on handstands and pushups. (There is a cushioned mat, and the director will spot the children so they do not hurt themselves.)1) First graders may get turned off by exercise if it is not presented as a game.2) First and second graders may not support their own weight well enough to do a handstand.3) Most children cannot do pushups or handstands before second grade.4) Younger children and older children are equally capable of supporting their own weight. im taking a poll for an assignment on which artists get most listened too.here are the options: sewerperson, deadbeat villains, KAMAARA,if you have listened to any of these post in the comments or answer. Look at the picture below to answer. If u answer correctly i will mark you as brainliest! PUNTOS GRATIS PARA LAS PERSONAS QUE LOS NECESITEN SOLO PIDO UN CHISTE ACAMBIO:) Please help!! Giving brainliest and extra points!! (Click on photo) HELP!!! I have no idea what the answer is. What do you think was the biggest problem facing the 55 delegates while composing the US constitution? The exhaust system of an automobile is first given an emission check and then given a vibration check. The result of an emissions check can be satisfactory (S), marginal (M), or unsatisfactory (U), and the result of a vibration check can be high vibration (H) or low vibration (L) or no vibration (N).What is the sample space for this situation?Sample Space = { }Find the event that the emissions check is satisfactory. Event = { } Who wrote the Magna Carta?ParliamentThe NoblesKing JohnKing George Where would parenthesis need to be placed in the expression to get a value of 44?(A) 2+3^2(53)(B) 2+(3^25)3(C) (2+3^2)53(D) (2+3)^253 answer for brainliest Acceleration due to gravity =100 m/s29.8 m/s262.3 m/s21.2 m/s2 did the passing of the 19th amendment totally place women at an equal playing field with men in all areas of society Determine the domain of the graph shown. A) [0, 8]B) [0, 24]C) [0, 20]D) [0, 10] HELP ME PLS !! The figure below has a point marked with a large dot. First, translate the figure 8 units to the left and 6 units up. Then, give the coordinates of the marked point in the original figure and the final figure. If anyone knows Spanish please help! Thanks! What is the height of the trapezoid if the Area = 26 un? What causes anions and cations to form ionic bonds? 9 points to 4 points, what is the percent