-2
def main():

    x = input("Input: ")

    convert(x)

def convert(a):
    #for loop over array of a e i o u
    v = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']

    for x in v:
        if x in a:
            a = a.replace(x, "")
    print(a)

if __name__ == "__main__":
    main()

This works fine but I want to make it more succinct. There surely is a way to ingnore case in the .replace

  • 2
    code review SE would be a better place to ask if the code works – depperm Mar 10 '23 at 18:20
  • 1
    Does this answer your question? [Correct code to remove the vowels from a string in Python](https://stackoverflow.com/questions/21581824/correct-code-to-remove-the-vowels-from-a-string-in-python) – Woodford Mar 10 '23 at 18:27

1 Answers1

2

You can use functions like .lower() and .upper() to handle such situations. For example, here you can make this small change x = input("Input: ").lower() and v = ['a', 'e', 'i', 'o', 'u'].

and it will work.

RUBINA
  • 23
  • 5