Reputation: 994
entry = input("Enter a word:")
if entry == whatever:
print("print this")
I keep getting error whatever is not defined. Why? I want to define it through input
Upvotes: 0
Views: 101
Reputation: 52071
whatever
is a string which you are comparing your input with, so you need to put it in quotes. As in
if entry == 'whatever':
Now a small demo after the necessary edit will output
Enter a word:whatever
print this
Upvotes: 3