Program help (beginner)

Borman, Linda E LBorman at sjm.com
Wed Oct 13 19:35:17 CEST 2004


Hi I am having problems with a program. Can you help.
see attachment and below for the code. Program using a function and using
"if, elif, else" 
 
What I'm trying to accomplish is to ask the user to enter there destination
with a choice of North, South, East, West.
When they have enter the destination, the reply will be "You have choosen
XXXXX", then it will ask the user "Please hit enter to find out what to
expect."  
 
 
What I want to happen when they hit enter is to have the program choose the
appropriate statement.
Example if they enter "North" the reply will be: "You must want to be cold"
Example if they enter "South" the reply will be: "You must want to be hot"
Example if they enter "West" the reply will be: "You must want to be in the
fog"
Example if they enter "East" the reply will be: "You must want to be in the
rain"
See below code

 
def travel_dest (direction):
    
    if direction1 (north):
        print "north"
    elif direction2 (south):
        print "south"
    elif direction3 (west):
        print "west"
    elif direction4 (east):
        print "east"
    else:
        print "You do not know where you want to go, huh!"
 
def Travel_location (area):
    if area1 (north):
        print "You must want to be cold"
    elif area2 (south):
        print "You must want to be hot"
    elif area3 (west):
        print "You must want to be where there migh be fog"
    elif area4 (east):
        print "You must want to be where there might be rain"
    else:
        print "You do not know where you want to go, huh!"
 

   
print "\nPlease enter the destination of where you would like to go." 
direction = raw_input("\nChoose North, South, West or East.")
print "\nYou have choosen:", direction
 
area = raw_input ("\n\nPlease hit enter to find out what to expect.")

print "\nHere is your results:"
raw_input ("Press the enter key to exit.")
    

 
 
Linda Borman

lborman at sjm.com


***************************** 
This communication may contain information that is proprietary, privileged,
confidential or legally exempt from disclosure.  If you are not a named
addressee, you are notified that you are not authorized to read, print,
retain, copy or disseminate this communication without the consent of the
sender and that doing so may be unlawful. If you have received this
communication in error, please notify the sender via return e-mail and
delete it from your computer. Thank you. St. Jude Medical, Inc. 
*****************************
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20041013/4d810c0d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Travel.py
Type: application/octet-stream
Size: 1667 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20041013/4d810c0d/attachment.obj>


More information about the Python-list mailing list