Learn

Now that we’ve completed our NAND_gate(), we can use that function to build other gates.

This time you’re starting from scratch, so lean on that truth table. Fortunately, our next gate, NOT only has one input.

Here’s the truth table:

a output
0 1
1 0

Instructions

1.

Define NOT_gate() which takes one input a and returns the outputs specified in the truth table.

You can do this using if/else statements, like with the last gate. But, if you want to challenge yourself, you can use NAND_gate() inside your NOT_gate().

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?