Log in from a computer to take this course

You'll need to log in from a computer to start Computer Architecture. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store

Our next gate is the AND gate. This gate receives two inputs and only returns current if the inputs are both on.

As in previous exercises, you’ll only be able to use gates you’ve previously built: NAND_gate(), and NOT_gate().

Here’s the truth table:

a b output
0 0 0
0 1 0
1 0 0
1 1 1



Define AND_gate() which has two parameters a and b.

AND_gate() should return 1 if both a and b are 1. It should return 0 otherwise.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?