Skip to content

Commit 8c15b50

Browse files
basic python
practice
1 parent b1eb196 commit 8c15b50

12 files changed

+17582
-0
lines changed
+274
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "691169d5",
6+
"metadata": {},
7+
"source": [
8+
": Kiran Sonkamble :9880994453 :krnsonkamble3@gmail.com"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": 3,
14+
"id": "a894894b",
15+
"metadata": {},
16+
"outputs": [
17+
{
18+
"name": "stdout",
19+
"output_type": "stream",
20+
"text": [
21+
"2063226088240 21.2\n"
22+
]
23+
}
24+
],
25+
"source": [
26+
"q=21.2\n",
27+
"print(id(q), q)"
28+
]
29+
},
30+
{
31+
"cell_type": "code",
32+
"execution_count": 5,
33+
"id": "f9d95b5f",
34+
"metadata": {},
35+
"outputs": [
36+
{
37+
"name": "stdout",
38+
"output_type": "stream",
39+
"text": [
40+
"add_44.400000000000006, diff_19.8, prod_394.83000000000004, div_0.38317757009345793, rem_12.3, qou_0.0, pow_9.68175474866133e+34\n"
41+
]
42+
}
43+
],
44+
"source": [
45+
"b= 12.3\n",
46+
"v= 32.10\n",
47+
"\n",
48+
"add_=v+b\n",
49+
"diff_=v-b\n",
50+
"prod_=v*b\n",
51+
"div_=b/v\n",
52+
"rem_=b%v\n",
53+
"qou_=b//v\n",
54+
"pow_=b**v\n",
55+
"\n",
56+
"print(f\"add_{add_}, diff_{diff_}, prod_{prod_}, div_{div_}, rem_{rem_}, qou_{qou_}, pow_{pow_}\")"
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": 7,
62+
"id": "5cce16c4",
63+
"metadata": {},
64+
"outputs": [
65+
{
66+
"name": "stdout",
67+
"output_type": "stream",
68+
"text": [
69+
"True\n",
70+
"False\n",
71+
"True\n",
72+
"False\n"
73+
]
74+
}
75+
],
76+
"source": [
77+
"n= 10.0\n",
78+
"m=23.54\n",
79+
"\n",
80+
"print(m>n) #Greater than, '>'\n",
81+
"print(m<n) #less than, '<'\n",
82+
"print(m>=n) #Greater than or equal to, '>='\n",
83+
"print(m<=n) #Less than or equal to, '<=' "
84+
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": 9,
89+
"id": "f081d935",
90+
"metadata": {},
91+
"outputs": [
92+
{
93+
"name": "stdout",
94+
"output_type": "stream",
95+
"text": [
96+
"False\n",
97+
"True\n"
98+
]
99+
}
100+
],
101+
"source": [
102+
"l= 12.65\n",
103+
"k= 909.90\n",
104+
"\n",
105+
"print(l==k)\n",
106+
"print(l!=k)"
107+
]
108+
},
109+
{
110+
"cell_type": "code",
111+
"execution_count": 23,
112+
"id": "96535623",
113+
"metadata": {},
114+
"outputs": [
115+
{
116+
"name": "stdout",
117+
"output_type": "stream",
118+
"text": [
119+
"20.3\n",
120+
"0.0\n",
121+
"0.0\n",
122+
"0.0\n",
123+
"10.2\n",
124+
"20.3\n",
125+
"20.3\n",
126+
"0.0\n",
127+
"False\n",
128+
"True\n"
129+
]
130+
}
131+
],
132+
"source": [
133+
"# Logical operators\n",
134+
"\n",
135+
"print(10.20 and 20.30)\n",
136+
"\n",
137+
"print(0.0 and 20.30) \n",
138+
"\n",
139+
"print(20.30 and 0.0) \n",
140+
"\n",
141+
"print(0.0 and 0.0) \n",
142+
"\n",
143+
"print(10.20 or 20.30)\n",
144+
"\n",
145+
"print(0.0 or 20.30) \n",
146+
"\n",
147+
"print(20.30 or 0.0) \n",
148+
"\n",
149+
"print(0.0 or 0.0) \n",
150+
"\n",
151+
"print(not 10.20) \n",
152+
"\n",
153+
"print(not 0.0) \n",
154+
"\n"
155+
]
156+
},
157+
{
158+
"cell_type": "code",
159+
"execution_count": 27,
160+
"id": "5fe8a051",
161+
"metadata": {},
162+
"outputs": [
163+
{
164+
"name": "stdout",
165+
"output_type": "stream",
166+
"text": [
167+
"140\n"
168+
]
169+
}
170+
],
171+
"source": [
172+
"# print(20 and 140)\n"
173+
]
174+
},
175+
{
176+
"cell_type": "code",
177+
"execution_count": 66,
178+
"id": "f80abf3b",
179+
"metadata": {},
180+
"outputs": [
181+
{
182+
"name": "stdout",
183+
"output_type": "stream",
184+
"text": [
185+
"10.2 10.2\n",
186+
"True\n",
187+
"False\n",
188+
"2063227769488 2063227769488\n"
189+
]
190+
}
191+
],
192+
"source": [
193+
"a = 10.20\n",
194+
"b = 10.20\n",
195+
"a=b \n",
196+
"print(a,b)\n",
197+
"print(a is b) \n",
198+
"print(a is not b)\n",
199+
"print(id(a), id(b))"
200+
]
201+
},
202+
{
203+
"cell_type": "code",
204+
"execution_count": 63,
205+
"id": "11d52f72",
206+
"metadata": {},
207+
"outputs": [],
208+
"source": [
209+
"\n",
210+
"# print(12.4 & 12.3)\n",
211+
"\n"
212+
]
213+
},
214+
{
215+
"cell_type": "markdown",
216+
"id": "fe468e07",
217+
"metadata": {},
218+
"source": [
219+
"Bitwise operation is not applicable between instances of float.\n",
220+
"Why the Id of float values are different when the same value is\n",
221+
"assigned to two different variables"
222+
]
223+
},
224+
{
225+
"cell_type": "code",
226+
"execution_count": 58,
227+
"id": "93a1d67a",
228+
"metadata": {},
229+
"outputs": [
230+
{
231+
"name": "stdout",
232+
"output_type": "stream",
233+
"text": [
234+
"True\n",
235+
"True\n",
236+
"True\n",
237+
"True\n",
238+
"True\n",
239+
"True\n"
240+
]
241+
}
242+
],
243+
"source": [
244+
"print('2.7' in 'Python2.7.8') \n",
245+
"print(10.20 in [10,10.20,10+20j,'Python']) \n",
246+
"print(10.20 in (10,10.20,10+20j,'Python')) \n",
247+
"print(20.30 in {1,20.30,30+40j}) \n",
248+
"print(1 in {1:100, 2.3:200, 30+40j:300}) \n",
249+
"print(10 in range(20)) "
250+
]
251+
}
252+
],
253+
"metadata": {
254+
"kernelspec": {
255+
"display_name": "Python 3 (ipykernel)",
256+
"language": "python",
257+
"name": "python3"
258+
},
259+
"language_info": {
260+
"codemirror_mode": {
261+
"name": "ipython",
262+
"version": 3
263+
},
264+
"file_extension": ".py",
265+
"mimetype": "text/x-python",
266+
"name": "python",
267+
"nbconvert_exporter": "python",
268+
"pygments_lexer": "ipython3",
269+
"version": "3.9.7"
270+
}
271+
},
272+
"nbformat": 4,
273+
"nbformat_minor": 5
274+
}

0 commit comments

Comments
 (0)