In python, The function remove_vowels takes one parameter, s, a string of any length. The function then returns a new string that contains all the letters in s except for the vowels: 'a', 'e', 'i', 'o', 'u'.  You may assume the string contains no upper-case letters. Hint: Accumulate the new string.      - Use a for loop to iterate over the characters in s      - Inside the loop, update the accumulator if the current character is not a lowercase vowel ( if ch not in 'aeiou' ) For example: Test Result print(remove_vowels("giraffe")) grff print(remove_vowels("love bug")) lv bg print(remove_vowels("racecar")) rccr print(remove_vowels("uoiea"))

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question

In python, The function remove_vowels takes one parameter, s, a string of any length. The function then returns a new string that contains all the letters in s except for the vowels: 'a', 'e', 'i', 'o', 'u'. 

You may assume the string contains no upper-case letters.

Hint: Accumulate the new string. 

    - Use a for loop to iterate over the characters in s 

    - Inside the loop, update the accumulator if the current character is not a lowercase vowel ( if ch not in 'aeiou' )

For example:

Test Result
print(remove_vowels("giraffe")) grff
print(remove_vowels("love bug")) lv bg
print(remove_vowels("racecar")) rccr
print(remove_vowels("uoiea"))  

 

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Problems on Number Theoretic Algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT