title: Passing parameters to a function in switch case using dictionary in python
body: <pre><code>def doblue (): print "The sea is blue"
  def dogreen (): print "Grass is green"
  def doyellow (): print "Sand is yellow"
  
  def redflag ():
      print "Red is the colour of fire"
      print "do NOT play with fire"
  
  def errhandler ():
      print "Your input has not been recognised"
  </code></pre>
  
  <h1>set up a dictionary of actions</h1>
  
  <pre><code>takeaction = {
  "blue": doblue,
  "green": dogreen,
  "yellow": doyellow,
  "red": redflag}
  
  colour = raw_input("Please enter red blue green or yellow ")
  takeaction.get(colour,errhandler)()
  </code></pre>
  
  <p>what if I have to pass some parameters to the doblue() or any function of that kind?? </p>