1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
bagirrra123 [75]
3 years ago
14

Create a dictionary named letter_counts that contains each letter and the number of times it occurs in string1. Challenge: Lette

rs should not be counted separately as upper-case and lower-case. Intead, all of them should be counted as lower-case.
Computers and Technology
1 answer:
Amanda [17]3 years ago
4 0

Answer:

  1. letter_counts = {}
  2. string1 = "I have a dream"
  3. string1 = string1.lower()
  4. for x in string1:
  5.    if(x == " "):
  6.        continue  
  7.    if x not in letter_counts:
  8.        letter_counts[x] = 1
  9.    else:
  10.        letter_counts[x] += 1
  11. print(letter_counts)

Explanation:

The solution is written in Python 3.

Firstly create a letter_count dictionary (Line 1)

Next, create a sample string and assign it to string1 variable and convert all the characters to lowercase using lower method (Line 4).

Create a for loop to traverse through each character in string1 and check if the current character is a single space, just skip to the next iteration (Line 7 -8). If the current character is not found in letter_counts dictionary, set the initial count value 1 to x property of letter_counts. Otherwise increment the x property value by one (Line 9 -12).

After completion of loop, print the letter_count dictionary. We shall get the sample output {'i': 1, 'h': 1, 'a': 3, 'v': 1, 'e': 2, 'd': 1, 'r': 1, 'm': 1}

You might be interested in
You have been on the phone with a user in a remote office for 30 minutes troubleshooting their minor desktop problem. No matter
Alecsey [184]

Answer:

D

Explanation:

First when you are troubleshooting a client your main goal is to solve their issue, you dont want to say hey call later i cant help you or say call someone else because picture this you need help and someone hangs up on you or says (B.) or (C.) it comes off as rude i would say. Regarding (A.) im not 100% sure what exactly do you mean by user's site? But asking for their manager (D.) or someone else (preferably higher up) seems to be the right action to be taken.

4 0
3 years ago
What is the main purpose of cutting plane line arrows?
Vedmedyk [2.9K]

The answer is (A)

The arrows themselves on the end of the line are used to indicate the direction of the sight for the section view and from which direction it is viewed in. These lines look like 2 perpendicular lines with arrows and are drawn at the end of the line.

 

 






5 0
3 years ago
The purpose of​ a/an _________ system is to capture best practice solutions and program them into a set of rules in a software p
Dmitriy789 [7]
The purpose of an expert system is to capture best practice solutions and program them into a set of rules in a software program. Expert systems are computers that use artificial intelligence technologies to simulate a behavior of a human or another subject. 
The knowledge about a specific subject is transformed with this system into a software code. 
8 0
3 years ago
Identify a statement that accurately differentiates between short-term memory and working memory.
Veronika [31]

Answer:

Short term memory is in which a person may forgot very previously introduced knowledge, whereas working memory...well...works. Most people have working memory.

Explanation:

5 0
3 years ago
Changing the configuration of a database falls under which category of databaseâ administration?
harkovskaia [24]
Changing the configuration of a database falls under which category of databaseâ administration?

d. operation
8 0
3 years ago
Other questions:
  • Which of the following correctly describes the function of an IP address?
    7·1 answer
  • Fix the 2 error codes.
    14·1 answer
  • How can a network design project benefit from the principles of itsm? How might itsm impede a network design project?
    11·1 answer
  • list six external parts or peripherals of a computer system and identify which are output and which are input devices
    8·1 answer
  • The business case for using grid computing involves all of the following except: speed of computation. cost savings. agility. in
    5·1 answer
  • Please tell fast plzzzzzzz​
    11·1 answer
  • You are a network administrator for your company. The network consists of a single Active Directory domain. All servers run Wind
    7·1 answer
  • Genres are useful for many reaseons. What are some explanations you can think of for how genres can be useful to players, game d
    5·1 answer
  • What is the second row of letters in the keyboard called?
    6·1 answer
  • Terence creates software requirements specification (SRS) documents for various software development projects. In which phase of
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!