Digital Solutions

Logic Gates


Use: logic.ly

Question 1

Input 1Input 2Output
offoffon
offonoff
onoffon
ononoff


#False means off
#True means on

top_switch = False
bottom_switch = False

first_gate = top_switch and bottom_switch
second_gate = not(first_gate or bottom_switch)
if second_gate:
    print("light on")
else:
    print("light off")


Question 2

Input 1Input 2Output
offoffon
offonon
onoffoff
ononon



Question 3

Input 1Input 2Output
offoffoff
offonoff
onoffon
ononon



Question 4

Input 1Input 2Output
offoffon
offonoff
onoffon
ononon


###########
#X Y OUTPUT
#0 0    1
#0 1    0
#1 0    1
#1 1    1
###########

x = False
y = True

if (not(x or y)) ^ x:
    print("on")
else:
    print("off")


Question 5

Input 1Input 2Input 3Output
offoffoffon
offoffonon
offonoffon
offononon
onoffoffoff
onoffonoff
ononoffoff
onononon