I want to remove all vowels from a string that the user gives. Below is my code and what I get as an output. For some reason the for loop is only checking the first character and nothing else.
Code:
sentence = "Hello World."
sentence = sentence.lower()
for x in sentence:
sentence = sentence.strip("aeiou")
print (x)
print (sentence)
Output:
hello world
I have the print(x) just to make sure it was looking at all the characters and looping the character amount. However when the loop reaches a vowel it doesn't seem to be doing what I want, which is remove it from the string.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…