title: How to switch directly to the desired condition without checking other conditions in Python?
body: <p>I have an python example code as:</p>
  
  <p>Input: (x,y)    </p>
  
  <pre><code>         if x==0 and y==0:    
              print x+y+1     
           elif x==0 and y==y:    
              print x+y*y+2    
           elif x==x and y==0:    
              print x*x+y+3    
           else:    
              print x*x+y*y+4    
  </code></pre>
  
  <p>How can I switch directly to the condition as, if my input is (x,y) = (0,0) it will output 1 without checking other conditions? </p>
  
  <p>I tried this using dictionary as,</p>
  
  <p>Input: (x,y)     </p>
  
  <pre><code>         def Case1():
                 print x+y+1     
           def Case2():      
                 print x+y*y+2     
           def Case3():
                 print x*x+y+3    
           def Case4():      
                 print x*x+y*y+4     
  
           dict = {(0,0): Case1,
                   (0,y): Case2,
                   (x,0): Case3,
                   (x,y): Case4,
           }  
  
           dict[(x,y)]()     
  </code></pre>
  
  <p>When I tried this with input (x,y) = (0,0), this gives me output as 4 instead of 1. It seems like, my code is checking only for the Case4. What I am doing wrong in the dictionary?</p>
  
  <p>Thanks!</p>