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
A certain manager makes the following statement "Our internet company is in business for the money, making profits, and making t
julia-pushkina [17]

Answer:

d. Stockholder theory

Explanation:

The theory of maximising profits

8 0
4 years ago
How do I install free premium iOS apps?
Wittaler [7]

Answer:

you go to the ios store

Explanation:

5 0
3 years ago
Which of the following is an example of a logic error?
Mumz [18]

Answer:

Receiving unexpected results from a program

Explanation:

Logic errors are due to the program not producing a desired result.

5 0
3 years ago
Read 2 more answers
What is iteration?????
maksim [4K]

Answer:

Iteration is a program repeated untill a condition is met

Explanation:

4 0
4 years ago
Read 2 more answers
Which of the following is a way the operating system prevents unknown or unauthorized users from accessing the system?
Xelga [282]

Put a code or security system on or a very secure password

Hope this helps...

6 0
3 years ago
Read 2 more answers
Other questions:
  • You have implemented nap with dhcp enforcement, so you need to ensure you have an updated anti-virus software package, an update
    7·1 answer
  • Every time you are asked to work with others, you are being asked to:
    6·2 answers
  • Which best compares and contrasts broadcasting a slide show and sending the presentation as a PDF?
    10·1 answer
  • Was LDAP version2 an internet standard in 1998? is it now?
    5·1 answer
  • What is the location in the base interface of the link to
    7·1 answer
  • Gold jewellery is made when solid-gold is melted and then put into containers which are the shape of the jewellery. After this t
    9·1 answer
  • There are 2048bytes in4megabytes true or false​
    10·1 answer
  • What a promblem Hypothesis<br>​
    8·2 answers
  • Five advantages of Internet​
    12·1 answer
  • Definition of Computer forensics?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!