I'm making a function that makes 50 random trees in a 1000 by 1000 area.
I need to make sure that Tree 2's x and y both are not the same as Tree 1's x and y. This takes a NAND Gate. I'm okay with one of them being the same, I'm okay with neither being the same, but not with both being the same. I can't seem to find anything about making NAND Gates in python. I'm fine with defining a function to make a NAND.
NAND Gate. The 'NAND' gate is a combination of 'AND' gate followed by 'NOT' gate. Opposite to 'AND' gate, it provides an output of 0 only when both the bits are set, otherwise 1. In Python, 'NAND()' function can be implemented using the 'AND()' and 'OR()' functions created before.
To evaluate complex scenarios we combine several conditions in the same if statement. Python has two logical operators for that. The and operator returns True when the condition on its left and the one on its right are both True . If one or both are False , then their combination is False too.
What is a NAND gate? A two-input NAND gate is a digital combination logic circuit that performs the logical inverse of an AND gate. While an AND gate outputs a logical “1” only if both inputs are logical “1,” a NAND gate outputs a logical “0” for this same combination of inputs.
Since NAND is the negation of and,
not (a and b)
should totally work, with a and b as inputs, or do I miss something?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With