Thursday 15 July 2010

Python 3.4.2 | NameError: name 'x' is not defined -



Python 3.4.2 | NameError: name 'x' is not defined -

i'm working on word based maze game in python 3.4.2, , having problems error message when seek run it: nameerror: name 'direction' not defined

this how have defined it:

def choosedirection(): direction = input('''what way go? (type left or right or forwards press enter.) ''')

then tried using 'direction' way:

if direction == str(right or right): print ('congrats! have turned right way, can live...') time.sleep(1) print ('for o.o')

i can't find issues code, , have checked other similar questions stackoverflow, none have worked.

here total code

any idea's appreciated , allow me know if need more information.

thanks, sebastian.

def checkdirection(choosedirection): print('you have entered maze.') time.sleep(0.5) if direction == str(right or right): print ('congrats! have turned right way, can live...') time.sleep(1) print ('for o.o')

replace direction choosedirection because argument trying pass ( or take value)

for if else if utilize

if (direction == 'right' or direction == 'left'):

also

def choosedirection(): direction = input('''what way go? (type left or right or forwards press enter.) ''') homecoming choosedirection

i think want homecoming direction, not choosedirection.

python python-3.x

No comments:

Post a Comment