I am trying to make a simple game for learning English grammar using Python. Basically, the user inputs the verb form and Python should return 'correct' or 'incorrect'. I am trying to do this using a function:
def simple_past():
question1 = input('I ____ to the park. Input: ').lower()
if input == 'went':
print('correct')
else:
print('incorrect')
But when I type in 'went', it always sends back 'incorrect'. My question is twofold: (1) why is it returning 'incorrect' even thought I am typing in 'went', (2) is this the best way to make this kind of activity? Cheers
if question1 == 'went':is what you should writeinputis just a built-in Python function. In your second line you assign the return value of it to the variablequestion1and it is that which you should check if it is== 'went'