farahm45
farahm45 farahm45
  • 14-03-2020
  • Computers and Technology
contestada

How do you remove a letter in python? I need to remove the letter a in whatever the user enters

Respuesta :

Lissylove
Lissylove Lissylove
  • 14-03-2020

Answer:

One can use replace() inside a loop to check for a bad_char and then replace it with the empty string hence removing it. This is the most basic approach and inefficient on performance point of view.

Explanation:

Call str. replace(old, new) with the character to remove as old and the empty string "" as new . Assign the resultant string to the original string's variable. Use a loop to iterate through a string of multiple specific characters and remove them

Answer Link

Otras preguntas

What is (-4.8y + 20.1) - (12.7y + 9.3)?
What does the drop in barometric pressure from 1003 millibars to 926 millibars tell  you about a hurricane?
Explain why Mercury,Venus,and Mars are not likely to support life as we know it.
What is (-4.8y + 20.1) - (12.7y + 9.3)?
The receptive surface for pollen on an angiosperm flower is the (A) anther (B) corolla (C) ovary (D) style (E) stigma
How do bacteria that live deep below the ocean’s surface make food? a. by cellular respiration b. by chemosynthesis c. by photosynthesis d. They eat other organ
Which of the following pairs does NOT represent a correct relationship? (A) glucose; polysaccharide (B) starch; polysaccharide (C) starch; carbohydrate (D) gluc
who is the aztec king
Explain why Mercury,Venus,and Mars are not likely to support life as we know it.
why do ecologist make models?