Thread: Python 3.0
View Single Post
Old 06-03-2009, 02:16 AM   #14 (permalink)
Zarcath
is a little tea pot.
 
Zarcath's Avatar
 
Join Date: Jan 2004
Location: Carlsbad CA
Posts: 6,465
+75 Internets
I've been trying to learn Python 3.0 on my own and I'm having problems getting user input to work. I'm not sure what the correct syntax is...

Code:
print ("There's a door to the north and road to the east.")

if input == north:
    print("You push your way through the door")
    else:
        print ("Which way do you want to go?")

if input == east:
    print("Something is preventing you from going that way")
    else:
        print ("Which way do you want to go?")
edit: so I figured out the input but typing East is returning with the North print. If I don't have the elif, typing North returns with both North and East prints.

Code:
print ("There's a house to the North and a cave to the East? ")
usercmd = input ("Which direction will you go?" )

if usercmd == ("North") or ("N"):
    print ("You move North towards the house.")

elif usercmd == ("East") or ("E"):
    print ("You attempt to enter the cave but find it is blocked.")
__________________

Last edited by Zarcath; 06-03-2009 at 03:45 PM..
Zarcath is offline   Reply With Quote

 
Uberguilds Network