I am trying to remove the vowels from a string: "This website is for losers LOL!" So when i try the following code it doesnt work and gives me the output which is same as the input:
str2="This website is for losers LOL!"
input1="aeiouAEIOU"
for char in input1:
newstr4=str2.replace(char,"")
print(newstr4)
But if i try the following code it works:
str2="This website is for losers LOL!"
input1="aeiouAEIOU"
newstr4=str2
for char in input1:
newstr4=newstr4.replace(char,"")
print(newstr4)
I just want to understand the difference between the two? Why does the first method not work when assign str2.replace to a new variable?