4 logic switch sending 0 v or 5 v represented by 0 and 1 on the switch... 0 is purple and 1 is pink... AND gate will conduct 5 v only if both input connector are 1 ...
ex: 0 0 = 0, 0 1 = 0, 1 0 = 0, 1 1 = 1...
NAND gate have opposite result so if you would have a 1 on a AND gate then result will be 0 and so on ... go try it !