Hi everyone,
I am writing a simple python guessing game.
simply, the program asks the user to guess a number, if the number is correct, it shows a message (You win!)... if wrong, it gives the user another chance.
But i have an error.
please check it out, and if you know how to solve it, please let me know.
the code:
gs = 1
first = 1
true = 5
def start(self):
if first == 1:
print('welcome')
g = input('Guess a number:')
guess = int(g)
if guess == true:
print('You win!')
gs = 0
else:
print('You Lose!!!')
first = 0
else:
g = input("Try again, it's between 0 and 10:")
guess = int(g)
if guess == true:
print('Finally you win!')
gs = 0
else:
print('Ooooh, you lose again!!!')
first = 0
while gs == 1:
start()
The error is
Traceback (most recent call last):
File "C:\...\GuessGame.py", line 25, in <module>
start()
TypeError: start() missing 1 required positional argument: 'self'