Q:

If user types ex. INF, all words that start with INF in a list are printed. How can I make a limit that only prints certain words?

I have a list containing words that starts with "INF.." and "INFO.."
When user inputs in "INF", I don't want the words that start with INFO printed too. How can i make a limit so that the "info" words are not printed?
weirdList = {"INF432", "INF678", "INFO123", "INFO654"}
filtered_list = []

for word in weirdList
   if word[0:3] == input:
       filtered_list.append(word)

My wish is that only "INF432" and "INF678" gets printed, and not "INFO.." when the user asks for words starting with "INF" 

A:

From you examples, I could see that you want to keep only the items that start with "INF" and are followed by numbers.For example "INFO" is "INF" followed by a "O". 
This can be achieved by this:
weirdList = {"INF432", "INF678", "INFO123", "INFO654"}
filtered_list = []

word1=input("enter something: ")

for word in weirdList:
   if word.startswith(word1) and word.replace(word1,"")[0].isnumeric():
     filtered_list.append(word)

print(filtered_list)

Output:
enter something: INF
['INF432', 'INF678']

This approach eliminates also "INFS01" and so on and works for other criteria than "INF".

