【发布时间】:2013-12-17 17:09:11
【问题描述】:
我正在制作一个函数,可以在 1000 x 1000 的区域中生成 50 棵随机树。
我需要确保树 2 的 x 和 y 都与树 1 的 x 和 y 不同。这需要一个与非门。我可以接受其中一个相同,我可以接受两者都不相同,但不能接受两者相同。我似乎找不到任何关于在 python 中制作 NAND Gates 的信息。我可以定义一个函数来制作 NAND。
【问题讨论】:
-
def nand(a, b): return not (a and b)有什么问题吗? -
我认为句子 "Tree 2's x and y both are not the same as Tree 1's x and y" 是“both”的不正确(且无意义)放置
标签: python variables logical-operators