#

Question Text#

Create a function named filter_num that has one parameter named num. Using if/else statements, your variable num, and all three operators (or their variants) >, <, and == create a function that will return True when your number is between {{ params_vars_lower }} and {{ params_vars_upper }} (both ), and False otherwise. However, if the number is {{ params_vars_invert }}, then the function should invert the otherwise expected output.

Your function will always be passed valid inputs and num will always be an integer.

You should consider testing your function with at least two different numbers (test1 and test2), and use assert statements to confirm your function works correctly.

Some example outputs to help you understand the problem:

  1. filter_num({{ params_examples_num1 }}) == {{ params_examples_output1 }}

  2. filter_num({{ params_examples_num2 }}) == {{ params_examples_output2 }}

  3. filter_num({{ params_examples_num3 }}) == {{ params_examples_output3 }}

  4. filter_num({{ params_examples_num4 }}) == {{ params_examples_output4 }}

Answer Section#

pl-submission-panel#

Attribution#

Problem is licensed under the CC-BY-NC-SA 4.0 license.
The Creative Commons 4.0 license requiring attribution-BY, non-commercial-NC, and share-alike-SA license.