Untitled

 avatar
unknown
python
9 months ago
639 B
1
Indexable
#initialising the lists
tWords = []
otherWords = []

#looping until we get "EXIT"
while True:
    userInput = input("Enter a word (or EXIT): ")
    #breaks the loop when gets "EXIT"
    if userInput.upper() == "EXIT":
        break
    else:
        #checks for T/t and stores in the list
        if userInput[0].upper() == "T":
            tWords.append(userInput)
        #stores all other words in other list
        else:
            otherWords.append(userInput)

#displaying all the outputs
print()
print("List of words start with T or t:")
print(tWords)
print()
print("List of other words:")
print(otherWords)
Editor is loading...
Leave a Comment