I am learning Python starting with 2.7 and working with a dictionary, wanted to execute a function in my program when the key is called. Looked on the net quite a bit, but either is not related or may just simply not understanding. Below is what I started doing as a concept while using one of my favorite games to learn.
Below is a more accurate representation of where I am currently at:
myDict = {
'descript': "This is some text to be printed",
'NORTH': northOfHouse (not sure if this is correct format)
}
def westOfHouse():
print myDict['descript]
if action == ('n' or 'north'):
myDict['NORTH]() (Not sure about proper format)
else:
print "there is no path in that direction
I have gotten the basic stuff to work when using a dictionary such as printing strings, modifying values, etc... just not getting how to make functions execute.