-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram1.py
75 lines (57 loc) · 2.35 KB
/
Program1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
def conjn(p,q):
return p and q
def disjn(p,q):
return p or q
def impln(p,q):
return not p or q
def Bi_condn(p,q):
return (not p or q) and (p or not q)
def XOR(p,q):
return (not p and q) or (p and not q)
def negation(p):
return not p
print(" Conjunction ")
print("-------------------------------------------------")
print("| p | q | r |")
print("-------------------------------------------------")
for p in [True , False]:
for q in [True , False]:
a=conjn(p,q)
print('|','\t',p,'\t','|','\t',q,'\t','|','\t',a,'\t','|')
print("--------------------------------------------------")
print(" Disjunction ")
print("-------------------------------------------------")
print("| p | q | r |")
print("-------------------------------------------------")
for p in [True , False]:
for q in [True , False]:
a=disjn(p,q)
print('|','\t',p,'\t','|','\t',q,'\t','|','\t',a,'\t','|')
print("--------------------------------------------------")
print(" Implication ")
print("-------------------------------------------------")
print("| p | q | r |")
print("-------------------------------------------------")
for p in [True , False]:
for q in [True , False]:
a=impln(p,q)
print('|','\t',p,'\t','|','\t',q,'\t','|','\t',a,'\t','|')
print("--------------------------------------------------")
print(" Bi-Conditinal ")
print("-------------------------------------------------")
print("| p | q | r |")
print("-------------------------------------------------")
for p in [True , False]:
for q in [True , False]:
a=Bi_condn(p,q)
print('|','\t',p,'\t','|','\t',q,'\t','|','\t',a,'\t','|')
print("--------------------------------------------------")
print(" XOR ")
print("-------------------------------------------------")
print("| p | q | r |")
print("-------------------------------------------------")
for p in [True , False]:
for q in [True , False]:
a=XOR(p,q)
print('|','\t',p,'\t','|','\t',q,'\t','|','\t',a,'\t','|')
print("--------------------------------------------------")