title: Query on python function that does the same as if statement
body: <p>I have written a solution for the below question.</p>
  
  <p>Q) Let's try to write a function that does the same thing as an if statement:</p>
  
  <pre><code>def if_function(condition, true_result, false_result):
      """Return true_result if condition is a true value, and false_result otherwise."""
      if condition:
          return true_result
      else:
          return false_result
  </code></pre>
  
  <p>This function actually does not do the same thing as an if statement in all cases. To prove this fact, write functions c, t, and f such that one of the functions returns the number 1, but the other does not:</p>
  
  <pre><code>def with_if_statement():
      if c():
          return t()
      else:
          return f()
  
  def with_if_function():
      return if_function(c(), t(), f())
  
  def c():
      "*** YOUR CODE HERE ***"
  
  def t():
      "*** YOUR CODE HERE ***"
  
  def f():
      "*** YOUR CODE HERE ***"
  </code></pre>
  
  <hr>
  
  <p>Solution:</p>
  
  <pre><code>&gt;&gt;&gt; def c():
      return 2 &lt; 3
  
  &gt;&gt;&gt; def t():
      return 2 &lt; 3
  
  &gt;&gt;&gt; def f():
      return not 2 &lt; 3
  
  &gt;&gt;&gt; print(with_if_function())
  True
  &gt;&gt;&gt; 
  </code></pre>
  
  <hr>
  
  <p>My question:</p>
  
  <p>Can you please confirm, if my solution is correct? </p>
  
  <p>or</p>
  
  <p>Do you think am yet to understand this question correctly?</p>