Home > Software design >  How can I remove all vowels from an inputted string
How can I remove all vowels from an inputted string

Time:12-04

This doesn't really work

To explain what I did: I set a vowel variable with a list Then I used a for loop to iterate through the list and print the letters not in the list

enter image description here

CodePudding user response:

as user @user56700 noted: You did, probably by mistake:

if not letter.lower in vowels:

instead:

if not letter.lower() in vowels:

first is method "itself", second is call of method.

P.S. also, as user @user56700 noted, do not screenshot and paste code as image. Just paste and format as code, it is really simple, and shows that min of respect for others :)

CodePudding user response:

import re

vowel = input()

lst = re.sub("[aeiouAEIOU]","",vowel)

print(lst)

  • Related