user2916424
user2916424

Reputation: 37

Input not working Python

I'm making a candy box game, but i cant get the input to work. The other problem is it prints 'You have 1 sweet.' and then stops. Please help?

import time, sys
print("Sweetie box")
sweets = 0
while True:
    time.sleep(1)
    sweets += 1
    print("You have ", sweets, " sweets.")
    INPUT = input()
    if INPUT == ("a"):
            print("It worked!")

Upvotes: 1

Views: 785

Answers (1)

user2555451
user2555451

Reputation:

You need to invoke the input built-in by adding () after it:

INPUT = input()

Right now, you have INPUT being set to the built-in itself. See a demonstration below:

>>> x = input
>>> x
<built-in function input>
>>> x = input()
word
>>> x
'word'
>>>

Upvotes: 1

Related Questions