I'm doing an assignment for school. I'm supposed to let the user make a list of ten words, and then I'm supposed to remove all the items in the list that start with a letter chosen by the user.
This is how I tried to do it, but it doesn't remove all the words that start with the letter.
I've troubleshooted as much as I'm able to with my limited knowledge, and It looks like the for loop just isn't going through all the words.
ordalisti = []
for i in range(10):
wordlist.append(str(input("Type a word: ").lower()))
letter = input("Choose a letter: ").lower()
for word in wordlist:
if word[0] == letter:
wordlist.remove(word)
print(wordlist)