I'm trying to create a function that accepts a string and replaces the vowels with other characters.
I've written some code, but when I run it in IDLE the output is 'None', but I'm expecting it to be '44 33 !! ooo000 ||||'
I have the below:
def vowel_swapper(string):
for char in string:
if char in 'aeiouAEIOU':
char.replace('a', '4').replace('A', '4').replace('e', '3').replace('E', '3')\
.replace('i', '!').replace('I', '!').replace('o', 'ooo').replace('O', '000').replace('u', '|_|').replace('U', '|_|')
print(vowel_swapper("aA eE iI oO uU"))
Where have I gone wrong here?
Edit: Thanks for all of the responses. I will also take on the advice about using a dictionary and look into it.