Skip to content

Commit 3eb90f1

Browse files
committed
added pythol Logical operator example
1 parent cc315c0 commit 3eb90f1

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

#5_Python_Logical_Operator.py

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Operator Description Example Try it
2+
# and Returns True if both statements are true x < 5 and x < 10
3+
# or Returns True if one of the statements is true x < 5 or x < 4
4+
# not Reverse the result, returns False if the result is true not(x < 5 and x < 10)
5+
6+
a=0
7+
print ("If variable value is equal to 0 then True else False:::::::::",not(a),)
8+
#Output Would be
9+
#True
10+
11+
a=1
12+
print ("If variable value is equal to 0 then True else False:::::::::",not(a),)
13+
#Output Would be
14+
#False
15+
16+
a=0;b=1
17+
print ("One of Both Condition are satisfied then True else False:::::::::",(a>b) or (b>a),)
18+
#Output Would be
19+
#True
20+
21+
a=0;b=1
22+
print ("Both Condition are satisfied then True else False:::::::::", (a>b) and (b>a),)
23+
#Output Would be
24+
#False
25+
26+
27+
a=0;b=1
28+
print ("Value are equal ?:::::::::", (a == b),)
29+
#Output Would be
30+
#False
31+
32+
a=0;b=0
33+
print ("a is b are equal ?:::::::::", (a is b),)
34+
#Output Would be
35+
#True
36+
37+
a=0;b=0
38+
print ("a is not equal to b ?:::::::::", (a is not b),)
39+
#Output Would be
40+
#False
41+
42+
a=0;b=1
43+
print ("a is not equal to b ?:::::::::", (a is not b),)
44+
#Output Would be
45+
#True

0 commit comments

Comments
 (0)