Skip to content

Commit ffb2292

Browse files
updated krishnaik06#1
1 parent cb4a197 commit ffb2292

File tree

9 files changed

+1350
-98
lines changed

9 files changed

+1350
-98
lines changed

1-Python Basics/1.0-basic.ipynb

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@
2525
},
2626
{
2727
"cell_type": "code",
28-
"execution_count": 1,
28+
"execution_count": 2,
2929
"metadata": {},
3030
"outputs": [
3131
{
3232
"name": "stdout",
3333
"output_type": "stream",
3434
"text": [
35-
"Krish\n",
36-
"Naik\n"
35+
"Pushkar\n",
36+
"Awsthi\n"
3737
]
3838
}
3939
],
4040
"source": [
4141
"## Basic Syntax Rules In Python\n",
4242
"## Case sensitivity- Python is case sensitive\n",
4343
"\n",
44-
"name=\"Krish\"\n",
45-
"Name=\"Naik\"\n",
44+
"name=\"Pushkar\"\n",
45+
"Name=\"Awsthi\"\n",
4646
"\n",
4747
"print(name)\n",
4848
"print(Name)\n"
@@ -102,43 +102,43 @@
102102
},
103103
{
104104
"cell_type": "code",
105-
"execution_count": 5,
105+
"execution_count": 3,
106106
"metadata": {},
107107
"outputs": [
108108
{
109109
"name": "stdout",
110110
"output_type": "stream",
111111
"text": [
112-
"43\n"
112+
"3\n"
113113
]
114114
}
115115
],
116116
"source": [
117117
"## Line Continuation\n",
118118
"##Use a backslash (\\) to continue a statement to the next line\n",
119119
"\n",
120-
"total=1+2+3+4+5+6+7+\\\n",
121-
"4+5+6\n",
120+
"total=1+1\\\n",
121+
"+1\n",
122122
"\n",
123123
"print(total)\n"
124124
]
125125
},
126126
{
127127
"cell_type": "code",
128-
"execution_count": 6,
128+
"execution_count": 5,
129129
"metadata": {},
130130
"outputs": [
131131
{
132132
"name": "stdout",
133133
"output_type": "stream",
134134
"text": [
135-
"15\n"
135+
"16\n"
136136
]
137137
}
138138
],
139139
"source": [
140140
"## Multiple Statements on a single line\n",
141-
"x=5;y=10;z=x+y\n",
141+
"x=5;y=10;k=1;z=x+y+k\n",
142142
"print(z)"
143143
]
144144
},
@@ -156,24 +156,24 @@
156156
},
157157
{
158158
"cell_type": "code",
159-
"execution_count": 10,
159+
"execution_count": 7,
160160
"metadata": {},
161161
"outputs": [
162162
{
163163
"data": {
164164
"text/plain": [
165-
"int"
165+
"str"
166166
]
167167
},
168-
"execution_count": 10,
168+
"execution_count": 7,
169169
"metadata": {},
170170
"output_type": "execute_result"
171171
}
172172
],
173173
"source": [
174174
"\n",
175175
"\n",
176-
"type(age)"
176+
"type(name)"
177177
]
178178
},
179179
{
@@ -291,11 +291,6 @@
291291
"### Conclusion:\n",
292292
"Understanding the syntax and semantics of Python is crucial for writing correct and meaningful programs. Syntax ensures the code is properly structured, while semantics ensures the code behaves as expected. Mastering these concepts will help in writing efficient and error-free Python code."
293293
]
294-
},
295-
{
296-
"cell_type": "markdown",
297-
"metadata": {},
298-
"source": []
299294
}
300295
],
301296
"metadata": {

1-Python Basics/1.1-Variables.ipynb

Lines changed: 41 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@
1717
"- Practical Examples and Common Errors"
1818
]
1919
},
20-
{
21-
"cell_type": "code",
22-
"execution_count": 1,
23-
"metadata": {},
24-
"outputs": [],
25-
"source": [
26-
"a=100"
27-
]
28-
},
2920
{
3021
"cell_type": "code",
3122
"execution_count": 2,
@@ -96,25 +87,22 @@
9687
},
9788
{
9889
"cell_type": "code",
99-
"execution_count": 7,
90+
"execution_count": 3,
10091
"metadata": {},
10192
"outputs": [
10293
{
103-
"data": {
104-
"text/plain": [
105-
"False"
106-
]
107-
},
108-
"execution_count": 7,
109-
"metadata": {},
110-
"output_type": "execute_result"
94+
"name": "stdout",
95+
"output_type": "stream",
96+
"text": [
97+
"Krish\n"
98+
]
11199
}
112100
],
113101
"source": [
114102
"## case sensitivity\n",
115103
"name=\"Krish\"\n",
116104
"Name=\"Naik\"\n",
117-
"\n"
105+
"print(name)\n"
118106
]
119107
},
120108
{
@@ -300,14 +288,14 @@
300288
},
301289
{
302290
"cell_type": "code",
303-
"execution_count": 26,
291+
"execution_count": 4,
304292
"metadata": {},
305293
"outputs": [
306294
{
307295
"name": "stdout",
308296
"output_type": "stream",
309297
"text": [
310-
"23 <class 'int'>\n"
298+
"1 <class 'int'>\n"
311299
]
312300
}
313301
],
@@ -320,65 +308,52 @@
320308
},
321309
{
322310
"cell_type": "code",
323-
"execution_count": 27,
311+
"execution_count": null,
324312
"metadata": {},
325313
"outputs": [
326314
{
327315
"name": "stdout",
328316
"output_type": "stream",
329317
"text": [
330-
"Sum: 66.0\n",
331-
"Difference: 46.0\n",
332-
"Product: 560.0\n",
333-
"Quotient: 5.6\n"
318+
"Sum: 15.0\n",
319+
"Difference: 0\n",
320+
"Product: 50.0\n",
321+
"Quotient: 0.5\n"
334322
]
335323
}
336324
],
337325
"source": [
338326
"### Simple calculator\n",
339-
"num1 = float(input(\"Enter first number: \"))\n",
340-
"num2 = float(input(\"Enter second number: \"))\n",
327+
"# num1 = float(input(\"Enter first number: \"))\n",
328+
"# num2 = float(input(\"Enter second number: \"))\n",
329+
"\n",
330+
"# sum = num1 + num2\n",
331+
"# difference = num1 - num2\n",
332+
"# product = num1 * num2\n",
333+
"# quotient = num1 / num2\n",
334+
"\n",
335+
"# print(\"Sum:\", sum)\n",
336+
"# print(\"Difference:\", difference)\n",
337+
"# print(\"Product:\", product)\n",
338+
"# print(\"Quotient:\", quotient)\n",
341339
"\n",
342-
"sum = num1 + num2\n",
340+
"num1 = float(input(\"Enter your first number: \"))\n",
341+
"num2 = float(input(\"Enter your second number: \"))\n",
342+
"\n",
343+
"sum = num1 + num2 \n",
344+
"# difference = max(num1 - num2, 0)\n",
343345
"difference = num1 - num2\n",
344-
"product = num1 * num2\n",
345-
"quotient = num1 / num2\n",
346+
"\n",
347+
"product= num1 * num2 \n",
348+
"quotient = num1 /num2\n",
346349
"\n",
347350
"print(\"Sum:\", sum)\n",
348351
"print(\"Difference:\", difference)\n",
349352
"print(\"Product:\", product)\n",
350-
"print(\"Quotient:\", quotient)\n"
353+
"print(\"Quotient:\", quotient)\n",
354+
"\n"
351355
]
352356
},
353-
{
354-
"cell_type": "code",
355-
"execution_count": null,
356-
"metadata": {},
357-
"outputs": [],
358-
"source": []
359-
},
360-
{
361-
"cell_type": "code",
362-
"execution_count": 25,
363-
"metadata": {},
364-
"outputs": [
365-
{
366-
"name": "stdout",
367-
"output_type": "stream",
368-
"text": [
369-
"23 <class 'int'>\n"
370-
]
371-
}
372-
],
373-
"source": []
374-
},
375-
{
376-
"cell_type": "code",
377-
"execution_count": null,
378-
"metadata": {},
379-
"outputs": [],
380-
"source": []
381-
},
382357
{
383358
"cell_type": "markdown",
384359
"metadata": {},
@@ -387,6 +362,11 @@
387362
"Variables are essential in Python programming for storing and manipulating data. Understanding how to declare, assign, and use variables effectively is crucial for writing functional and efficient code. Following proper naming conventions and understanding variable types will help in maintaining readability and consistency in your code."
388363
]
389364
},
365+
{
366+
"cell_type": "markdown",
367+
"metadata": {},
368+
"source": []
369+
},
390370
{
391371
"cell_type": "markdown",
392372
"metadata": {},

1-Python Basics/1.3-operators.ipynb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
{
3939
"cell_type": "code",
40-
"execution_count": 4,
40+
"execution_count": 1,
4141
"metadata": {},
4242
"outputs": [
4343
{
@@ -102,7 +102,7 @@
102102
},
103103
{
104104
"cell_type": "code",
105-
"execution_count": 6,
105+
"execution_count": 4,
106106
"metadata": {},
107107
"outputs": [
108108
{
@@ -111,7 +111,7 @@
111111
"4.2"
112112
]
113113
},
114-
"execution_count": 6,
114+
"execution_count": 4,
115115
"metadata": {},
116116
"output_type": "execute_result"
117117
}
@@ -149,16 +149,16 @@
149149
},
150150
{
151151
"cell_type": "code",
152-
"execution_count": 8,
152+
"execution_count": 6,
153153
"metadata": {},
154154
"outputs": [
155155
{
156156
"data": {
157157
"text/plain": [
158-
"True"
158+
"False"
159159
]
160160
},
161-
"execution_count": 8,
161+
"execution_count": 6,
162162
"metadata": {},
163163
"output_type": "execute_result"
164164
}
@@ -167,7 +167,7 @@
167167
"## Comparison Operators\n",
168168
"## == Equal to\n",
169169
"a=10\n",
170-
"b=10\n",
170+
"b=11\n",
171171
"\n",
172172
"a==b"
173173
]
@@ -197,22 +197,24 @@
197197
},
198198
{
199199
"cell_type": "code",
200-
"execution_count": 12,
200+
"execution_count": 9,
201201
"metadata": {},
202202
"outputs": [
203203
{
204204
"data": {
205205
"text/plain": [
206-
"False"
206+
"True"
207207
]
208208
},
209-
"execution_count": 12,
209+
"execution_count": 9,
210210
"metadata": {},
211211
"output_type": "execute_result"
212212
}
213213
],
214214
"source": [
215215
"## Not Equal to !=\n",
216+
"str1=\"Krish\"\n",
217+
"str2=\"Krish2\"\n",
216218
"str1!=str2"
217219
]
218220
},

0 commit comments

Comments
 (0)