─=≡Σ((( つ•̀ω•́)つ CS Bootcamp 2020

Day 2

Logic Gates

AND Gate

Only TRUE when TRUE & TRUE AND Gate

OR Gate

TRUE when either is TRUE OR Gate

NOT Gate

Opposite of everything NOT Gate

NAND Gate

Not and NAND Gate

NOR Gate

Not or OR Gate

XOR Gate

Exclusive or gate XOR Gate

Two digit adder

Two digit adder

Boolean in Python

Equal

1 == 1
# compares two things to each other
x = 1
# assigns the value 1 to the variable x

If statements

if condition:
# if the condition is true
    do something
    # do this stuff

Else if statements

elif condition:
# done if the "if" statement is false
# check if the condition is true
    do something
    # do this stuff

Else statements

else:
# if all the if and elif statements are false
	do this stuff

Loops

While loop

while condition:
# while this condition is true
	do this
	# do this stuff

For loop

for x in range (y,z):
	do stuff
# repeats the "do stuff" for z-y times

Sample solution to the final game

The full sample solution can be found here on our class GitHub repository.

Homework

Challenge you parents to play the game, then ask for their feedback.