This is a small program that will keep asking an input until required input is given.
we should keep the required number as a string, otherwise it may not work. input is taken as string by default
required_number = '18' while True: number = input("Enter the number\n") if number == required_number: print ("GOT IT") break else: print ("Wrong number try again")
or you can use eval(input()) method
required_number = 18 while True: number = eval(input("Enter the number\n")) if number == required_number: print ("GOT IT") break else: print ("Wrong number try again")