File tree Expand file tree Collapse file tree 3 files changed +236
-2
lines changed Expand file tree Collapse file tree 3 files changed +236
-2
lines changed Original file line number Diff line number Diff line change 3
3
#There Two Types Of Data Types In Python
4
4
# https://app.eraser.io/workspace/oKpScDjNGei3NCGzrIsE?origin=share
5
5
6
- # 1.Immutable
7
- # 2.Mutable
6
+ # 1.Immutable ( Those which are not change able)
7
+ # 2.Mutable ( Those which are change able)
8
8
9
9
# 1.Mutable
10
10
# List
Original file line number Diff line number Diff line change
1
+ #Number Methods In Python
2
+ #https://app.eraser.io/workspace/GAxdlLIVgYAFpJf17bM1?origin=share
3
+
4
+ #Integors
5
+
6
+ a = 1 ;
7
+ b = 123456789 ;
8
+ c = - 987654321 ;
9
+
10
+ print (type (a )) ;
11
+ print (type (b )) ;
12
+ print (type (c )) ;
13
+
14
+ #Floating Point Number
15
+
16
+ d = 1.1 ;
17
+ e = 1.0 ;
18
+ f = - 35.457 ;
19
+
20
+ print (type (d )) ;
21
+ print (type (e )) ;
22
+ print (type (f )) ;
23
+
24
+ #Float can also be scientific numbers with an "e" to indicate the power of 10.
25
+
26
+ x = 23e45 ;
27
+ y = 12E4 ;
28
+ z = - 87.7e237 ;
29
+
30
+ print (type (x )) ;
31
+ print (type (y )) ;
32
+ print (type (z )) ;
33
+
34
+ #Complex Number
35
+
36
+ m = 3 + 5j ;
37
+ n = - 4j ;
38
+ o = 4j ;
39
+
40
+ print (type (m )) ;
41
+ print (type (n )) ;
42
+ print (type (o )) ;
43
+
44
+
45
+ #Coversion
46
+
47
+ num1 = 1 ; #int
48
+ num2 = 22.45 ; #float
49
+ num3 = 5j ; #complex
50
+
51
+ #Convert From int To float
52
+ num4 = float (num1 );
53
+ print (num4 ) ;
54
+ print (type (num4 )) ;
55
+
56
+ #Convert From float To integer
57
+ num5 = int (num2 );
58
+ print (num5 ) ;
59
+ print (type (num5 )) ;
60
+
61
+ #Convert From int To complex
62
+ num6 = complex (num1 );
63
+ print (num6 ) ;
64
+ print (type (num6 )) ;
65
+
66
+ #Import the random module, and display a random number from 1 to 9:
67
+
68
+ import random ;
69
+
70
+ print (random .randrange (1 ,10 ))
Original file line number Diff line number Diff line change
1
+ #Arthimetic Operators :
2
+
3
+ # + : Additon
4
+ # - : Substraction
5
+ # * : Multiplication
6
+ # / : Division
7
+ # ** : Exponentiation
8
+ # % : Modulus
9
+ # // : Floor Division
10
+
11
+
12
+ # ' + '
13
+
14
+ num1 = 6 ;
15
+ num2 = 4 ;
16
+ print (num1 + num2 );
17
+
18
+ # ' - '
19
+
20
+ num3 = 36 ;
21
+ num4 = 14 ;
22
+ print (num3 - num4 );
23
+
24
+ # ' * '
25
+
26
+ num5 = 6 ;
27
+ num6 = 4 ;
28
+ print (num5 + num6 );
29
+
30
+ # ' / '
31
+
32
+ num7 = 2 ;
33
+ num8 = 44 ;
34
+ print (num7 / num8 );
35
+
36
+
37
+ # ' ** '
38
+
39
+ num9 = 4 ;
40
+ num10 = 5 ;
41
+ print (num9 ** num10 )
42
+
43
+ # ' % '
44
+
45
+ num11 = 7 ;
46
+ num12 = 2 ;
47
+ print ( num11 % num12 )
48
+
49
+ # ' // '
50
+
51
+ num13 = 15 ;
52
+ num14 = 2 ;
53
+ print (num13 // num14 )
54
+
55
+
56
+ #Assigment Operators
57
+
58
+ # = : x = 5
59
+ # += : x = x + 5
60
+ # -= : x = x - 5
61
+ # /= : x = x/3
62
+ # *= : x = x * 3
63
+ # %= : x = x % 5
64
+ # //= : x = x // 4
65
+ # **= : x = x ** 4
66
+ # &= : x = x & 5
67
+ # |= : x = x | 4
68
+ # ^= : x = x ^ 3
69
+ # >>= : x = x >> 5
70
+ # <<= : x = x << 4
71
+ # := : x = 3 ; print(x)
72
+
73
+
74
+ # ' = '
75
+
76
+ a = 5 ;
77
+ print (a )
78
+
79
+ # ' += '
80
+
81
+ b = 5 ;
82
+ b += 4 ;
83
+
84
+ print (b )
85
+
86
+ # ' -= '
87
+
88
+ c = 4 ;
89
+ c -= 1 ;
90
+
91
+ print (c )
92
+
93
+ # ' /= '
94
+
95
+ d = 6 ;
96
+ d /= 3 ;
97
+
98
+ print (d )
99
+
100
+ # ' *= '
101
+
102
+ e = 7 ;
103
+ e *= 2 ;
104
+
105
+ print (e )
106
+
107
+ # ' %= '
108
+
109
+ f = 20 ;
110
+ f %= 3 ;
111
+
112
+ print (f )
113
+
114
+ # ' //= '
115
+
116
+ g = 5 ;
117
+ g //= 3 ;
118
+
119
+ print (g )
120
+
121
+ # ' **= '
122
+
123
+ h = 4 ;
124
+ h **= 4 ;
125
+
126
+ print (h )
127
+
128
+ # ' &= '
129
+
130
+ i = 5 ;
131
+ i &= 3 ;
132
+
133
+ print (i )
134
+
135
+ # ' |= '
136
+
137
+ j = 5 ;
138
+ j |= 3 ;
139
+ print (j )
140
+
141
+ # ' ^= '
142
+
143
+ k = 5 ;
144
+ k ^= 3 ;
145
+
146
+ print (k )
147
+
148
+ # ' >>= '
149
+
150
+ l = 7 ;
151
+ l >>= 4 ;
152
+
153
+ print (l )
154
+
155
+ # ' <<= '
156
+
157
+ m = 10 ;
158
+ m <<= 14 ;
159
+
160
+ print (m )
161
+
162
+ # ' := '
163
+
164
+ print ( n := 13 )
You can’t perform that action at this time.
0 commit comments