Guessing game: Difficulty importing class and getting it to function. PYTHON

Viewed 22

I am making a guessing game. I wanted to create a guess counter module in a modules.py doc and import it into my main.py so i could access its instance for other modules.

The only problem is I cant get it to function.

main.py code ##

guess = Guess_Counter(0)


print("Welcome to the guessing game you have 3 guesses your first riddle is: \n")

while True and (guess) < 4: 
    print("I am cool as a breeze, I stop your heart with ease, seasons may be my enemy, but im part of you and you are friend to me. What am I? \n")
    print("Enter your guess or type 'hint', or 'quit' below.")
    answer = input()
    answer = answer.upper()
    guess += 1

    if "sneeze" in answer.upper():
       print("Great work, your next riddle is: \n")
       break

    elif answer == "hint": 
        guess.guess -= 1
        print("Achoo!\n")
        
    
    elif answer == "quit" or guess == 4:
           print("Better luck next time! ")
           quit()

    else:
        print("Try again!")

Testmodules.py code ##

class Guess_Counter():

  def __init__(self, numguess):
    self.numguess = numguess
0 Answers
Related