Python Question?

Python Question?
0.0 0

#1

I’m reading a book on beginner’s python programming…can someone tell me why this simple program isn’t working?

me = {
    "height": "6",
    "fav_color": "red",
    "fav_author": "Orwell"
}

answer = input("Type height, fav_color or fav_author")
if answer in me:
    result = me[answer]
print(result)

What am I missing here?


#2

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

What problems are you having with this code?


#3

are you coding in python 2.x or 3.x?


#4

What are you hoping print(result) will return?


#6

that’s why I was asking :slight_smile: if this is Python 2 then there should be raw_input()


#7

please mention whether its python 2.x or 3.x
. I think there is an EOF error condition. No data is given when you are calling raw input. You need to code properly. For more tech stuff go to https://netgears.support/netgear-powerline/