Python Question?

Python Question?
0.0 0


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]

What am I missing here?


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?


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


What are you hoping print(result) will return?


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


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