#Follow me on grepper :D #Using break in loop types while True: user= input("are you want to close program (y/n)? ") if user == "y": break elif user=="n": print("ok") else: print("invalid")