2019-04-12
閱讀量:
653
python中函數(shù)的用法
如果兩個(gè)輸入中的任何一個(gè)為1,則或門給出輸出1,否則給出0。

# Python3 progarm to illustrate
# working of OR gate
def OR(a, b):
if a == 1:
return True
elif b == 1:
return True
else:
return False
# Driver code
if __name__=='__main__':
print(OR(0, 0))
print("+---------------+----------------+")
print(" | OR Truth Table | Result |")
print(" A = False, B = False | A AND B =",OR(False,False)," | ")
print(" A = False, B = True | A AND B =",OR(False,True)," | ")
print(" A = True, B = False | A AND B =",OR(True,False)," | ")
print(" A = True, B = True | A AND B =",OR(True,True)," | ")






評(píng)論(0)


暫無(wú)數(shù)據(jù)
CDA考試動(dòng)態(tài)
CDA報(bào)考指南
推薦帖子
0條評(píng)論
0條評(píng)論
0條評(píng)論
0條評(píng)論