← Back to challenges

Equality Check

PythonMediumlogiclanguage_fundamentalsvalidation

Instructions

In this challenge, you must verify the equality of two different values given the parameters a and b.

Both the value and type of the parameters need to be equal. The possible types of the given parameters are:

  • Numbers
  • Strings
  • Booleans (False or True)
  • Special values: None

What have you learned so far that will permit you to do two different checks (value and type) with a single statement?

Implement a function that returns True if the parameters are equal, and False if they are not.

Examples

check_equality(1, true) ➞ False
# A number and a boolean: the value and type are different.

check_equality(0, "0") ➞ False
# A number and a string: the type is different.

check_equality(1,  1) ➞ True
# A number and a number: the type and value are equal.

Notes

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Format III: Keyword Arguments