How can I specify an unknown number in a list as a conditional statement in a for loop?

Code:

def find_num():
    lst = [5, 8, 4, 6, 9, 2]
    limit = len(lst)
    for tries in range(limit):
        answer = int(input("Type a guess: "))

        if answer in lst:
            print("Correct guess!")
        else:
            print("Wrong!")
  • tries = 0 and tries += 1 is not necessary in for loop.
  • Type casting is done by int(answer) not by answer == int
if tries > limit:
    break
  • The above condition is tested by for loop itself.