1 Star 0 Fork 0

王其/逻辑门

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
basicgate.py 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
王其 提交于 2021-12-17 01:13 . add basicgate.py.
#coding=utf-8
import elementgate
def roc_not(a):
return elementgate.roc_nand(a, a)
def roc_and(a, b):
return roc_not(elementgate.roc_nand(a,b))
def roc_or(a,b):
return roc_not(elementgate.roc_nor(a,b))
def roc_xor(a,b):
return roc_and(roc_or(a,b),elementgate.roc_nand(a,b))
if __name__=="__main__":
print("1与0与非:",elementgate.roc_nand(1,0))
print("0与1与非:",elementgate.roc_nand(0,1))
print("0与0与非:",elementgate.roc_nand(0,0))
print("1与1与非:",elementgate.roc_nand(1,1))
print("1与0或非:",elementgate.roc_nor(1,0))
print("0与1或非:",elementgate.roc_nor(0,1))
print("0与0或非:",elementgate.roc_nor(0,0))
print("1与1或非:",elementgate.roc_nor(1,1))
print("0非:",roc_not(0))
print("1非:",roc_not(1))
print("1与0与门:",roc_and(1,0))
print("0与1与门:",roc_and(0,1))
print("0与0与门:",roc_and(0,0))
print("1与1与门:",roc_and(1,1))
print("1与0或门:",roc_or(1,0))
print("0与1或门:",roc_or(0,1))
print("0与0或门:",roc_or(0,0))
print("1与1或门:",roc_or(1,1))
print("1与0异或门:",roc_xor(1,0))
print("0与1异或门:",roc_xor(0,1))
print("0与0异或门:",roc_xor(0,0))
print("1与1异或门:",roc_xor(1,1))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wang-qi3206/logic-gate.git
git@gitee.com:wang-qi3206/logic-gate.git
wang-qi3206
logic-gate
逻辑门
master

搜索帮助