Please anyone help me with why this happens | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please anyone help me with why this happens

The problem is we have to remove all the vowels from a string and print out the string. But it's not getting printed so It prints the same input string as such Could you please help me out My code : def disemvowel(string): for letter in string: if letter in 'AEIOUaeiou': string.replace(letter,"") return string Output fail condition : Test Results: 'This website is for losers LOL!' should equal 'Ths wbst s fr lsrs LL!'

23rd Jan 2019, 6:20 PM
Balaji Pathange
Balaji Pathange - avatar
2 Answers
+ 3
https://code.sololearn.com/cFYbRlKMM71H/?ref=app I have made some (of what I think of as) improvements to your code and fixed the given issue. This was a very nice piece of code and I enjoyed the challenge! Hope you continue to have fun coding! 😁
24th Jan 2019, 1:56 AM
Ian Ault
Ian Ault - avatar
0
The 'replace' method doesn't modify its argument. It is returns new string instead. a = 'solo' a.replace('l', "") print(a) # prints solo print(a.replace('l', "") # prints soo
23rd Jan 2019, 6:50 PM
portpass