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 system administrator suspects that there is an error in the replication configuration. How can the system administrator look f
Kamila [148]

Answer:

Option D i.e., By going to Event Viewer > Directory Service Log is the correct option.

Explanation:

The following option is not false because the admin of the system assumes that there is the occurrence of the particular error message related to the replication, the main reason behind this is that the administrator firstly go the Event Viewer then, he go to the Directory Service Log. After that, a particular error message appears in the replication configuration.

7 0
3 years ago
How have newspapers and magazines adapted to digital technology?
Ahat [919]

Answer:

Most newspapers now have online editions. Subscription models have gone beyond print-only into digital-only and print-digital combinations -- and as print-only circulation is dropping, digital and combination circulation is on the rise.

6 0
3 years ago
Select the three business advantages of globalization.
Anna007 [38]

Answer:

There is increased collaboration in problem solving.

There are increased business opportunities.

It facilitates ease in communication

4 0
3 years ago
Which type of application architecture has a logic tier
LuckyWell [14K]

Answer:

hi

Explanation:

7 0
3 years ago
Read 2 more answers
Why do some people think the global<br> economy is good for the United States?
maksim [4K]

Answer: is a

Explanation:

3 0
3 years ago
Other questions:
  • A rectangular box that displays information or a program is called
    13·1 answer
  • When reading data across the network (i.e. from a URL) in Python 3, what string method must be used to convert it to the interna
    9·1 answer
  • What does it mean for a school to be “accredited”?
    5·1 answer
  • The information gathering technique that enables the analyst to collect facts and opinions from a wide range of geographically d
    11·1 answer
  • In this assignment, you will write a complete C program that will act as a simplecommand-line interpreter (i.e., a shell) for th
    12·1 answer
  • A ___________ assigns levels of risk to various threats to network security by comparing the nature of the threats to the contro
    9·1 answer
  • 1.Menciona tres factores o variables que consideras influirán en el oscurecimiento del alimento cortado o pelado expuesto a la i
    8·1 answer
  • True or false we can used virus not use pirated software and programs ​
    10·1 answer
  • A workstation is out of compliance with the group policy standards set by the domain what command prompt would you use to ensure
    5·1 answer
  • Element of python which is valid syntax patterns
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!