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 9316495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:38:04+00:00 2026-06-19T02:38:04+00:00

Question: Define a function isVowel(char) that returns True if char is a vowel (‘a’,

  • 0

Question:

Define a function isVowel(char) that returns True if char is a vowel (‘a’, ‘e’, ‘i’, ‘o’, or ‘u’), and False otherwise. You can assume that char is a single letter of any case (ie, ‘A’ and ‘a’ are both valid).

Do not use the keyword in. Your function should take in a single string and return a boolean.

Code Given:

def isVowel(char):
    '''
    char: a single letter of any case

    returns: True if char is a vowel and False otherwise.
    '''

My Code:

def isVowel(char):
    '''
    char: a single letter of any case

    returns: True if char is a vowel and False otherwise.
    '''
    if char == 'a' or 'e' or 'i' or 'o' or 'u' or 'A' or 'E' or 'I' or 'O' or 'U':
        return True
    else:
        return False

My Problem:
My output is always True. What am I doing wrong?

  • 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-06-19T02:38:06+00:00Added an answer on June 19, 2026 at 2:38 am

    Your if statement:

    if char == 'a' or 'e' or 'i' or 'o' or 'u' or 'A' or 'E' or 'I' or 'O' or 'U':
            return True
    

    is equivalent to:

    if (char == 'a') or 'e' or 'i' or 'o' or 'u' or 'A' or 'E' or 'I' or 'O' or 'U':
    

    which will always be evaluated to either True, or e which is also True, and hence your function always returns True.

    Change your if-statement to:

    if char == 'a' or char == 'e' or char == 'i' so on...:
            return True
    

    But, this problem is really simple if you can use in operator. This goes like this:

    def isVowel(char):
        return char.lower() in 'aeiou'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm stuck on a homework question. I'm trying to define a function that checks
first question: Define a function that joins a list of lists together using a
Question : What is the proper way to define a function in JavaScript that
In the answers to this question , we read that function f() {} defines
Can anyone help me in the following question please? Define a macro which has
Ok, this might be kiddies question in java. We can't define two public classes
I am trying to define a function that will include a variable n where
A simple question... Is it good practice to define a function accepting more than
I dont understand javascript syntax well,my question: How jquery define click function for get
I have this question to do: Define a function findpath:: BTree a -> a

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.