[Baypiggies] code down sizing

Brain Murphy brianomorchoe at yahoo.co.uk
Fri Sep 1 22:51:53 CEST 2006


I am having problems down sizing my code. My parents asked me to make a program were they can go into and find the recipe that they are looking for, and it will tell them the issue it is in.
   
  My code is huge and I have not been able to make it smaller
  <<<
  def print_options():
    print " Cover Recipes"
    print "Options"
    print "'P' Print options"
    print " please chose a-z corresponding with the recipe name you are looking for."
    print "'B' capital B to go back"
  choice = "P"
while choice !="B":
    if choice == "a":
        import a
    elif choice == "b":
        print "No recipes were found that start with B"
    elif choice == "c":
        import c
  ........................
        elif choice == "z":
         print "No recipes were found that start with Z"
    elif choice != "B":
        print_options()
    choice = raw_input("Enter choice: ")>>>
   
  as you can see it is huge for its size, I know it can be smaller like
  choice  = raw_input("Enter letter:%") for % in %'s list
  list = az-aZ-AZ 
  if choice in list = % import %
   
  or something along those lines but I can not figure it out. Can any one help me with this?
  Brian
  

 

 		
---------------------------------
 The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/baypiggies/attachments/20060901/019ca697/attachment.htm 


More information about the Baypiggies mailing list