Jan-17-2022, 01:09 AM
Is this more like what you are trying to do?
import sys class MainProgram (): def __init__ (self): self.main_loop () def Won_Game(self): print("You won the game.") def Lost_Game(self): print ("Sorry... You lost.") def main_loop (self): print("Welcome to my Classes Python program! Do you want,") print ('to (C)ontinue gmae or (Q)uit game? Press "1" or "2') answer = input("> ") while True : if answer == "2" : print ("See ya later.") sys.exit () if answer == "1": print("What do you want to do?") print("1. Do you want to Win the game, press (1)") print("2. Do you want to Lose the game, press (2)") answer_2 = input("> ") if answer_2 == "2": print("You pressed (2)") # You Lost, go to function self.Lost_Game () elif answer_2 == "1": print("you pressed 1") # Won Game self.Won_Game () else: print(f"Wrong selection, {answer_2}") print("Error!") print("1. Do you want to play again, press (1)") print("2. Do you want to quit now, press (2)") answer = input ("> ") MainProgram ()