title: Creating a Menu in Python
body: <p>I'm working on making a menu in python that needs to: </p>
  
  <ol>
  <li>Print out a menu with numbered options</li>
  <li>Let the user enter a numbered option</li>
  <li>Depending on the option number the user picks, run a function specific to that action. For now, your function can just print out that it's being run.</li>
  <li>If the user enters in something invalid, it tells the user they did so, and re-display the menu</li>
  <li>use a dictionary to store menu options, with the number of the option as the key, and the text to display for that option as the value.</li>
  <li>The entire menu system should run inside a loop and keep allowing the user to make choices until they select exit/quit, at which point your program can end.</li>
  </ol>
  
  <p>I'm new to Python, and I can't figure out what I did wrong with the code. </p>
  
  <p>So far this is my code: </p>
  
  <pre><code>ans=True
  while ans:
      print (""""
      1.Add a Student
      2.Delete a Student
      3.Look Up Student Record
      4.Exit/Quit
      """")
      ans=input("What would you like to do?" 
      if ans=="1": 
        print("\nStudent Added") 
      elif ans=="2":
        print("\n Student Deleted") 
      elif ans=="3":
        print("\n Student Record Found") 
      elif ans=="4":
        print("\n Goodbye") 
      elif ans !="":
        print("\n Not Valid Choice Try again") 
  </code></pre>
  
  <p>ANSWERED</p>
  
  <p>This is what he wanted apparently:</p>
  
  <pre><code>menu = {}
  menu['1']="Add Student." 
  menu['2']="Delete Student."
  menu['3']="Find Student"
  menu['4']="Exit"
  while True: 
    options=menu.keys()
    options.sort()
      for entry in options: 
        print entry, menu[entry]
  
      selection=raw_input("Please Select:") 
      if selection =='1': 
        print "add" 
      elif selection == '2': 
        print "delete"
      elif selection == '3':
        print "find" 
      elif selection == '4': 
        break
      else: 
        print "Unknown Option Selected!" 
  </code></pre>