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
Cerrena [4.2K]
3 years ago
13

Implement the following functions def normalize(input_string): input: a string of text characters. Each character is called a to

ken. output: an array of 'letters'. Each item in the array corresponds to a letter in input_string (in lowercase) for example, the input "O.K. #1 Python!" would generate the following list: ['o','k','p','y','t','h','o','n'] take a look at the Python documentation for string functions (url given below); don't try to replace, delete, or substitute -- if the 'token' is a letter it passes the test.
Computers and Technology
1 answer:
Crank3 years ago
6 0

Answer:

  1. def normalize(input_string):
  2.    output = []
  3.    for c in input_string:
  4.        if(c.isalpha()):
  5.            output.append(c.lower())
  6.    
  7.    return output
  8.    
  9. print(normalize("O.K. #1 Python!"))

Explanation:

Firstly, create a function normalize that takes one input string (Line 1).

Next, we create an empty list and assign it to output variable (Line 2). This list will hold all the letters from the input string.

Create a for loop to traverse each of the character in the input string (Line 4) and then use isalpha() method to check if the current character is a letter (Line 5). If so, add the letter to output list (Line 6). Please note we can convert the letter to lowercase using lower() method.

After completing the loop, return the output list (Line 8).

We can test the function using the sample input given in the question (Line 10) and we shall get ['o', 'k', 'p', 'y', 't', 'h', 'o', 'n']

You might be interested in
Match the job task to the occupation that would perform it. 1. Research the causes and treatments of diseases physical scientist
Trava [24]

Answer:

1.Physical scientist

2.Life scientist

3.Electrical engineer

4.aerospace engineer

Explanation:

5 0
3 years ago
Wice each lunar month, all year long, these tides occur. Whenever the Moon, Earth and Sun are aligned, the gravitational pull of
DENIUS [597]
E)   none of those   Adds; Spring
8 0
3 years ago
Help!!
Eduardwww [97]

the undo option is the right answer



8 0
3 years ago
Read 2 more answers
How is abstraction used in a GPS system
ipn [44]
The designs on the map of the GPS system Im would think but can you be more specific?
8 0
4 years ago
Read 2 more answers
Anyone who uses Edmentum Plato homeschool can anyone please help me my biology is not loading and it says flash is not available
Pavlova-9 [17]
Turn off your computer, wait 10 minutes, turn it back on. Open your browser, and go to the website. If it is still not working, I would assume that this is not a problem with your computer, but the network was not loaded properly, and should be fixed with some patience. In the mean time, you may have the day off.
8 0
4 years ago
Read 2 more answers
Other questions:
  • Olivia wants to add buttons and clickable features to her website. Which language should she use?
    10·2 answers
  • Theâ ______ is a large worldwide collection of networks that use a common protocol to communicate with one another.
    5·1 answer
  • What was one of the first inventions that made it possible to communicate almost instantly?
    11·1 answer
  • This type of software works with end users, application software, and computer hardware to handle the majority of technical deta
    12·1 answer
  • As photography developed, a variety of materials were employed as image capture surfaces. Choose the correct order
    7·1 answer
  • Exercise 3.6.9: 24 vs. "24"5 points
    7·1 answer
  • Different between input and output device​
    5·1 answer
  • You receive an email that appears to legitimately be from your Bank. The email indicates the need for verification of your infor
    15·2 answers
  • Priortization is an example of a skill that helps you reach long term goals because
    14·1 answer
  • Select the three concepts of capital outlay.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!