Skip to the content.

Logic Gates

None

Logic   Gates

Popcorn Hack 1

Real world example of AND logic gate:

2 factor authentication - must have password AND other method of verification

This is helpful to make accounts and pages nore secure for users.

Popcorn Hack 2

A. (X AND Y) OR Z

Homework Hack

def secure_entry_system(keycard, pin):
    def AND(a, b):
        if a + b == 2:
            return 1
        else:
            return 0


    return AND(keycard, pin)

# Test cases
print(secure_entry_system(1, 1))  # Expected Output: 1 (Access Granted)
print(secure_entry_system(0, 1))  # Expected Output: 0 (Access Denied)
print(secure_entry_system(1, 0))  # Expected Output: 0 (Access Denied)
print(secure_entry_system(0, 0))  # Expected Output: 0 (Access Denied)
1
0
0
0