Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6474931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:38:44+00:00 2026-05-25T06:38:44+00:00

Expected: >>> removeVowels(‘apple’) ppl >>> removeVowels(‘Apple’) ppl >>> removeVowels(‘Banana’) ‘Bnn’ Code (Beginner): def removeVowels(word):

  • 0

Expected:

>>> removeVowels('apple')
"ppl"
>>> removeVowels('Apple')
"ppl"
>>> removeVowels('Banana')
'Bnn'

Code (Beginner):

def removeVowels(word):
    vowels = ('a', 'e', 'i', 'o', 'u')
    for c in word:
        if c in vowels:
            res = word.replace(c,"")
    return res 

How do I both lowercase and uppercase?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:38:44+00:00Added an answer on May 25, 2026 at 6:38 am

    Here is a version using a list instead of a generator:

    def removeVowels(word):
        letters = []            # make an empty list to hold the non-vowels
        for char in word:       # for each character in the word
            if char.lower() not in 'aeiou':    # if the letter is not a vowel
                letters.append(char)           # add it to the list of non-vowels
        return ''.join(letters) # join the list of non-vowels together into a string
    

    You could also write it just as

    ''.join(char for char in word if char.lower() not in 'aeiou')
    

    Which does the same thing, except finding the non-vowels one at a time as join needs them to make the new string, instead of adding them to a list then joining them at the end.

    If you wanted to speed it up, making the string of values a set makes looking up each character in them faster, and having the upper case letters too means you don’t have to convert each character to lowercase.

    ''.join(char for char in word if char not in set('aeiouAEIOU'))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I expected this code to replace the hate with some love. NSMutableString *teststring=@I hate
I expected the following code to print 8, 111 and 999. I supposed that
I expected to see the word test appear in the output once and the
Getting Expected ',' or '{' but found '#44559' error. My code looks like this:
I expected the code below to alert 0 and 1, but it alert 2
expected unqualified-id before '{' Where is this error on my code? Thanks everyone! #include
Rather than outputting the expected string of Bar , the following code outputs what
receiving the error expected something between the word 'gcv' and the 'AND' keyword. Now
I get the following compilation error: error: expected `;' before 'it' Here's my code:
I expected this code to print 'Same 1' and 'Same2', but it prints only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.