AiSc 5

Pasted Nov 4, 2026, 3:47 PM1 file24 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/ai5
untitled
def mc_culloch_pitts(inputs, weights, threshold):
    # Calculate the linear combination of inputs and weights
    net_input = sum(x * w for x, w in zip(inputs, weights))

    # Threshold firing rule
    return 1 if net_input >= threshold else 0


# Simulate AND Gate (Weights = [1,1], Threshold = 2)
# Simulate OR Gate (Weights = [1,1], Threshold = 1)

inputs_list = [[0, 0], [0, 1], [1, 0], [1, 1]]

print("AND Gate Simulation:")

for x in inputs_list:
    output = mc_culloch_pitts(x, weights=[1, 1], threshold=2)
    print(f"  Input: {x} -> Output: {output}")

print("\nOR Gate Simulation:")

for x in inputs_list:
    output = mc_culloch_pitts(x, weights=[1, 1], threshold=1)
    print(f"  Input: {x} -> Output: {output}")

727 chars · codepastes.com