Gunnm
Gunnm

Reputation: 994

Asking for input in Python 3.4

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

Answers (1)

Bhargav Rao
Bhargav Rao

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

Related Questions