1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created on Thu Jul 29 03:31:58 2021
4
+
5
+ @author: mjach
6
+ """
7
+
8
+ '''Comparisions example with numbers '''
9
+
10
+ # > greater than sign
11
+ # >= greater than equal to sign
12
+ # < less than sign
13
+ # <= less than equal to sign
14
+
15
+ # print('100 < 200 =', 100 < 200)
16
+ # print('100 <= 100 =', 100 <= 100)
17
+ # print('100 < 50 =', 100 < 50)
18
+ # print('100 <= 90 =', 100 <= 90)
19
+
20
+ # print('\n') # to get a new line
21
+
22
+ # print('200 > 100 =', 200 > 100)
23
+ # print('200 >= 200 =', 200 >= 200)
24
+ # print('200 > 500 =', 200 > 500)
25
+ # print('200 >= 500 =', 200 >= 500)
26
+
27
+ # print('-20 is greater than 20 ?:', -20 > 20)
28
+
29
+ '''
30
+ Equality
31
+ Comparisions example with equals(==) and not equals(!=)
32
+ will return boolen result either True or False
33
+ '''
34
+
35
+ answer_one = 1
36
+ answer_two = 1
37
+
38
+ #print('True or False:',answer_one == answer_two)
39
+
40
+ answer_one = 5
41
+ answer_two = 1
42
+ #print('True or False:',answer_one != answer_two)
43
+
44
+ answer_one = 'apple'
45
+ answer_two = 'apple'
46
+
47
+ # print('True or False:',answer_one == answer_two)
48
+ # print('True or False:',answer_one != answer_two)
49
+
50
+ '''Identity check
51
+ is or is not key words. (is) is similiar to == and (is not) is similiar to !=
52
+ '''
53
+ fruit_list_one = ['apple' , 'banana' ]
54
+ fruit_list_two = ['apple' , 'banana' ]
55
+
56
+ #checking for equality
57
+
58
+ #print(fruit_list_one == fruit_list_two) # will give true or false result
59
+
60
+ #checking for identity
61
+ # both list has different memory address so when checking for identy
62
+ # it will give false result because both list has different memory address.
63
+
64
+ #print(fruit_list_one is fruit_list_two) # will give true or false result
65
+
66
+ '''
67
+ is and is not checking for built in types like None, True and False
68
+ '''
69
+
70
+ one = True
71
+
72
+ print ('One is True :' ,one is True )
73
+
74
+ two = False
75
+ print ('Two is fasle:' ,two is False )
76
+ print ('Two is not true:' , two is not False )
0 commit comments