├── All Docs ├── Master Data Science and Data Analysis with Pandas.pdf ├── OOP in Python.pdf ├── Practical Statistics for Data Scientists.pdf ├── Python Notes For Professionals.pdf ├── Python Roadmap.pdf └── Readme.md ├── Day 02 - 60 days of Python.ipynb ├── Day 03 - 60 Days of Python.ipynb ├── Day 04 - 60 Days of Python.ipynb ├── Day 06 - 60 Days of Python.ipynb ├── Day 07 - 60 Days of Python.ipynb ├── Day 08 - 60 Days of Python.ipynb ├── Day 09 - 60 Days of Python.ipynb ├── Day 10 - 60 Days of Python.ipynb ├── Day 11 - 60 Days of Python.ipynb ├── Day 12 - 60 Days of Python.ipynb ├── Day 13 - 60 Days of Python.ipynb ├── Day 14 - 60 Days of Python.ipynb ├── Day 16 - 60 Days of Python.ipynb ├── Day 17 - 60 Days of Python.ipynb ├── Day 18 - 60 Days of Pythonn.ipynb ├── Day 19 - 60 Days of Python.ipynb ├── Day 20 - 60 Days of Python.ipynb ├── Day 21 - 60 Days of Python.ipynb ├── Day 22 - 60 Days of Python.ipynb ├── Day 23 - 60 days of python.ipynb ├── Day 24 - 60 Days of Python.ipynb ├── Day 25 - 60 Days of Python.ipynb ├── Day 26 - 60 Days of Python.ipynb ├── Day 27 - 60 Days of Python.ipynb ├── Day 28 - 60 Days of Python.ipynb ├── Day 29 - 60 Days of Python.ipynb ├── Day 30 - 60 Days of Python.ipynb ├── Day 30.2 - More About Return.ipynb ├── Day 31 - 60 Days of Python.ipynb ├── Day 33 - 60 Days of Python - Breakup.ipynb ├── Day 34 - 60 Days of Python.ipynb ├── Day 35 - 60 Days of Python - parameters vs arguments.ipynb ├── Day 36 - 60 Days of Python.ipynb ├── Day 37 - 60 Days of Python.ipynb ├── Day 38 - 60 Days of Python - map, filter, reduce.ipynb ├── Day 39 - Demo file.ipynb ├── Day 39 - Main.ipynb ├── Day 40 - 60 Days of Python.ipynb ├── Day 41 - 60 Days of Python - Working with Files.ipynb ├── Day 42 - 60 Days of Python - Working with PDFs.ipynb ├── Day 43 - 60 Days of Python.ipynb ├── OOP in Python.pdf ├── Python Problems.pdf ├── Python Roadmap.pdf ├── README.md └── test /All Docs/Master Data Science and Data Analysis with Pandas.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rashakil-ds/60-Days-of-Python-by-Study-Mart-AI-QUEST/206265c75faf11936079af3bbaf4c6e6330884a6/All Docs/Master Data Science and Data Analysis with Pandas.pdf -------------------------------------------------------------------------------- /All Docs/OOP in Python.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rashakil-ds/60-Days-of-Python-by-Study-Mart-AI-QUEST/206265c75faf11936079af3bbaf4c6e6330884a6/All Docs/OOP in Python.pdf -------------------------------------------------------------------------------- /All Docs/Practical Statistics for Data Scientists.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rashakil-ds/60-Days-of-Python-by-Study-Mart-AI-QUEST/206265c75faf11936079af3bbaf4c6e6330884a6/All Docs/Practical Statistics for Data Scientists.pdf -------------------------------------------------------------------------------- /All Docs/Python Notes For Professionals.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rashakil-ds/60-Days-of-Python-by-Study-Mart-AI-QUEST/206265c75faf11936079af3bbaf4c6e6330884a6/All Docs/Python Notes For Professionals.pdf -------------------------------------------------------------------------------- /All Docs/Python Roadmap.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rashakil-ds/60-Days-of-Python-by-Study-Mart-AI-QUEST/206265c75faf11936079af3bbaf4c6e6330884a6/All Docs/Python Roadmap.pdf -------------------------------------------------------------------------------- /All Docs/Readme.md: -------------------------------------------------------------------------------- 1 | Author info:
2 | KM Rashedul Alam 3 | -------------------------------------------------------------------------------- /Day 09 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "57f8fc27", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 1, 17 | "id": "5183ea2b", 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "data = 'python'" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": 2, 27 | "id": "7b2721ca", 28 | "metadata": {}, 29 | "outputs": [ 30 | { 31 | "data": { 32 | "text/plain": [ 33 | "'p'" 34 | ] 35 | }, 36 | "execution_count": 2, 37 | "metadata": {}, 38 | "output_type": "execute_result" 39 | } 40 | ], 41 | "source": [ 42 | "data[0]" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 3, 48 | "id": "ccfb7a33", 49 | "metadata": {}, 50 | "outputs": [ 51 | { 52 | "data": { 53 | "text/plain": [ 54 | "'n'" 55 | ] 56 | }, 57 | "execution_count": 3, 58 | "metadata": {}, 59 | "output_type": "execute_result" 60 | } 61 | ], 62 | "source": [ 63 | "data[-1]" 64 | ] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": 6, 69 | "id": "884cf099", 70 | "metadata": {}, 71 | "outputs": [ 72 | { 73 | "name": "stdout", 74 | "output_type": "stream", 75 | "text": [ 76 | "p x\n", 77 | "y x\n", 78 | "t x\n", 79 | "h x\n", 80 | "o x\n", 81 | "n x\n" 82 | ] 83 | } 84 | ], 85 | "source": [ 86 | "for x in data:\n", 87 | " print(x,'x')" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": 7, 93 | "id": "a9ba2b4a", 94 | "metadata": {}, 95 | "outputs": [ 96 | { 97 | "data": { 98 | "text/plain": [ 99 | "range(0, 10)" 100 | ] 101 | }, 102 | "execution_count": 7, 103 | "metadata": {}, 104 | "output_type": "execute_result" 105 | } 106 | ], 107 | "source": [ 108 | "range(10)" 109 | ] 110 | }, 111 | { 112 | "cell_type": "code", 113 | "execution_count": 8, 114 | "id": "cdf13b1f", 115 | "metadata": {}, 116 | "outputs": [ 117 | { 118 | "name": "stdout", 119 | "output_type": "stream", 120 | "text": [ 121 | "p\n", 122 | "y\n", 123 | "t\n", 124 | "h\n", 125 | "o\n", 126 | "n\n" 127 | ] 128 | } 129 | ], 130 | "source": [ 131 | "for x in range(len(data)):\n", 132 | " print(data[x])" 133 | ] 134 | }, 135 | { 136 | "cell_type": "code", 137 | "execution_count": 9, 138 | "id": "670f4f9e", 139 | "metadata": {}, 140 | "outputs": [ 141 | { 142 | "data": { 143 | "text/plain": [ 144 | "6" 145 | ] 146 | }, 147 | "execution_count": 9, 148 | "metadata": {}, 149 | "output_type": "execute_result" 150 | } 151 | ], 152 | "source": [ 153 | "len(data)" 154 | ] 155 | }, 156 | { 157 | "cell_type": "code", 158 | "execution_count": 10, 159 | "id": "6108daa5", 160 | "metadata": {}, 161 | "outputs": [ 162 | { 163 | "name": "stdout", 164 | "output_type": "stream", 165 | "text": [ 166 | "p\n", 167 | "y\n", 168 | "t\n", 169 | "h\n", 170 | "o\n", 171 | "n\n" 172 | ] 173 | } 174 | ], 175 | "source": [ 176 | "for x in range(6):\n", 177 | " print(data[x])" 178 | ] 179 | }, 180 | { 181 | "cell_type": "code", 182 | "execution_count": 12, 183 | "id": "a7349f01", 184 | "metadata": {}, 185 | "outputs": [ 186 | { 187 | "name": "stdout", 188 | "output_type": "stream", 189 | "text": [ 190 | "i\n", 191 | " \n", 192 | "l\n", 193 | "o\n", 194 | "v\n", 195 | "e\n", 196 | " \n", 197 | "d\n", 198 | "a\n", 199 | "t\n", 200 | "a\n", 201 | " \n", 202 | "s\n", 203 | "c\n", 204 | "i\n", 205 | "e\n", 206 | "n\n", 207 | "c\n", 208 | "e\n", 209 | " \n", 210 | "s\n", 211 | "o\n", 212 | " \n", 213 | "m\n", 214 | "u\n", 215 | "c\n", 216 | "h\n" 217 | ] 218 | } 219 | ], 220 | "source": [ 221 | "data = 'i love data science so much'\n", 222 | "for i in range(len(data)):\n", 223 | " print(data[i])" 224 | ] 225 | }, 226 | { 227 | "cell_type": "code", 228 | "execution_count": 13, 229 | "id": "662ce24d", 230 | "metadata": {}, 231 | "outputs": [ 232 | { 233 | "name": "stdout", 234 | "output_type": "stream", 235 | "text": [ 236 | "i\n", 237 | " \n", 238 | "l\n", 239 | "o\n", 240 | "v\n", 241 | "e\n", 242 | " \n", 243 | "d\n", 244 | "a\n", 245 | "t\n", 246 | "a\n", 247 | " \n", 248 | "s\n", 249 | "c\n", 250 | "i\n", 251 | "e\n", 252 | "n\n", 253 | "c\n", 254 | "e\n", 255 | " \n", 256 | "s\n", 257 | "o\n", 258 | " \n", 259 | "m\n", 260 | "u\n", 261 | "c\n", 262 | "h\n" 263 | ] 264 | } 265 | ], 266 | "source": [ 267 | "data = 'i love data science so much'\n", 268 | "for x in range(len(data)):\n", 269 | " print(data[x])" 270 | ] 271 | }, 272 | { 273 | "cell_type": "code", 274 | "execution_count": 14, 275 | "id": "8cf81041", 276 | "metadata": {}, 277 | "outputs": [ 278 | { 279 | "data": { 280 | "text/plain": [ 281 | "['i', 'love', 'data', 'science', 'so', 'much']" 282 | ] 283 | }, 284 | "execution_count": 14, 285 | "metadata": {}, 286 | "output_type": "execute_result" 287 | } 288 | ], 289 | "source": [ 290 | "data.split()" 291 | ] 292 | }, 293 | { 294 | "cell_type": "code", 295 | "execution_count": 1, 296 | "id": "78ae1ebd", 297 | "metadata": {}, 298 | "outputs": [ 299 | { 300 | "name": "stdout", 301 | "output_type": "stream", 302 | "text": [ 303 | "i 0\n", 304 | "love 1\n", 305 | "data 2\n", 306 | "science 3\n", 307 | "so 4\n", 308 | "much 5\n" 309 | ] 310 | } 311 | ], 312 | "source": [ 313 | "data = 'i love data science so much'\n", 314 | "data = data.split()\n", 315 | "for i in range(len(data)):\n", 316 | " print(data[i],i)" 317 | ] 318 | }, 319 | { 320 | "cell_type": "code", 321 | "execution_count": 17, 322 | "id": "6d701de8", 323 | "metadata": {}, 324 | "outputs": [ 325 | { 326 | "data": { 327 | "text/plain": [ 328 | "'love'" 329 | ] 330 | }, 331 | "execution_count": 17, 332 | "metadata": {}, 333 | "output_type": "execute_result" 334 | } 335 | ], 336 | "source": [ 337 | "data[1]" 338 | ] 339 | }, 340 | { 341 | "cell_type": "code", 342 | "execution_count": 3, 343 | "id": "f53338d3", 344 | "metadata": {}, 345 | "outputs": [ 346 | { 347 | "name": "stdout", 348 | "output_type": "stream", 349 | "text": [ 350 | "301\n" 351 | ] 352 | } 353 | ], 354 | "source": [ 355 | "n = [2,3,4,55,60,77,100]\n", 356 | "total = 0\n", 357 | "for x in n:\n", 358 | " total = total+x\n", 359 | " #print(total,x)\n", 360 | "print(total)" 361 | ] 362 | }, 363 | { 364 | "cell_type": "code", 365 | "execution_count": 7, 366 | "id": "529856df", 367 | "metadata": {}, 368 | "outputs": [ 369 | { 370 | "name": "stdout", 371 | "output_type": "stream", 372 | "text": [ 373 | "2 2\n", 374 | "5 3\n", 375 | "9 4\n", 376 | "64 55\n", 377 | "124 60\n", 378 | "201 77\n", 379 | "301 100\n", 380 | "Total 301\n" 381 | ] 382 | } 383 | ], 384 | "source": [ 385 | "n = [2,3,4,55,60,77,100]\n", 386 | "total = 0\n", 387 | "for x in n:\n", 388 | " total = total+x\n", 389 | " print(total,x)\n", 390 | "print('Total',total)" 391 | ] 392 | }, 393 | { 394 | "cell_type": "code", 395 | "execution_count": 25, 396 | "id": "e5f7dfca", 397 | "metadata": {}, 398 | "outputs": [ 399 | { 400 | "name": "stdout", 401 | "output_type": "stream", 402 | "text": [ 403 | "data science 0\n", 404 | "data science 1\n", 405 | "data science 2\n", 406 | "data science 3\n", 407 | "data science 4\n", 408 | "data science 5\n", 409 | "data science 6\n", 410 | "data science 7\n", 411 | "data science 8\n", 412 | "data science 9\n" 413 | ] 414 | } 415 | ], 416 | "source": [ 417 | "for i in range(10):\n", 418 | " print('data science',i)" 419 | ] 420 | }, 421 | { 422 | "cell_type": "code", 423 | "execution_count": 26, 424 | "id": "1cf8f59b", 425 | "metadata": {}, 426 | "outputs": [ 427 | { 428 | "name": "stdout", 429 | "output_type": "stream", 430 | "text": [ 431 | "data science 5\n", 432 | "data science 6\n", 433 | "data science 7\n", 434 | "data science 8\n", 435 | "data science 9\n" 436 | ] 437 | } 438 | ], 439 | "source": [ 440 | "for i in range(5,10): #n-1\n", 441 | " print('data science',i)" 442 | ] 443 | }, 444 | { 445 | "cell_type": "code", 446 | "execution_count": 27, 447 | "id": "ac109b2b", 448 | "metadata": {}, 449 | "outputs": [ 450 | { 451 | "name": "stdout", 452 | "output_type": "stream", 453 | "text": [ 454 | "data science 5\n", 455 | "data science 7\n", 456 | "data science 9\n" 457 | ] 458 | } 459 | ], 460 | "source": [ 461 | "for i in range(5,10,2): # i = i+2\n", 462 | " print('data science',i)" 463 | ] 464 | }, 465 | { 466 | "cell_type": "code", 467 | "execution_count": 28, 468 | "id": "dc02a16f", 469 | "metadata": {}, 470 | "outputs": [ 471 | { 472 | "name": "stdout", 473 | "output_type": "stream", 474 | "text": [ 475 | "data science 100\n", 476 | "data science 90\n", 477 | "data science 80\n", 478 | "data science 70\n", 479 | "data science 60\n" 480 | ] 481 | } 482 | ], 483 | "source": [ 484 | "for i in range(100,50,-10): # i = i+2\n", 485 | " print('data science',i)" 486 | ] 487 | }, 488 | { 489 | "cell_type": "code", 490 | "execution_count": 29, 491 | "id": "bd78f1ee", 492 | "metadata": {}, 493 | "outputs": [ 494 | { 495 | "name": "stdout", 496 | "output_type": "stream", 497 | "text": [ 498 | "100\n", 499 | "98\n", 500 | "96\n", 501 | "94\n", 502 | "92\n", 503 | "90\n", 504 | "88\n", 505 | "86\n", 506 | "84\n", 507 | "82\n", 508 | "80\n", 509 | "78\n", 510 | "76\n", 511 | "74\n", 512 | "72\n", 513 | "70\n", 514 | "68\n", 515 | "66\n", 516 | "64\n", 517 | "62\n", 518 | "60\n", 519 | "58\n", 520 | "56\n", 521 | "54\n", 522 | "52\n", 523 | "50\n", 524 | "48\n", 525 | "46\n", 526 | "44\n", 527 | "42\n", 528 | "40\n", 529 | "38\n", 530 | "36\n", 531 | "34\n", 532 | "32\n", 533 | "30\n", 534 | "28\n", 535 | "26\n", 536 | "24\n", 537 | "22\n", 538 | "20\n", 539 | "18\n", 540 | "16\n", 541 | "14\n", 542 | "12\n", 543 | "10\n", 544 | "8\n", 545 | "6\n", 546 | "4\n", 547 | "2\n" 548 | ] 549 | } 550 | ], 551 | "source": [ 552 | "for i in range(100,0,-2): # i = i+2\n", 553 | " print(i)" 554 | ] 555 | }, 556 | { 557 | "cell_type": "code", 558 | "execution_count": null, 559 | "id": "bb06263c", 560 | "metadata": {}, 561 | "outputs": [], 562 | "source": [] 563 | } 564 | ], 565 | "metadata": { 566 | "kernelspec": { 567 | "display_name": "Python 3 (ipykernel)", 568 | "language": "python", 569 | "name": "python3" 570 | }, 571 | "language_info": { 572 | "codemirror_mode": { 573 | "name": "ipython", 574 | "version": 3 575 | }, 576 | "file_extension": ".py", 577 | "mimetype": "text/x-python", 578 | "name": "python", 579 | "nbconvert_exporter": "python", 580 | "pygments_lexer": "ipython3", 581 | "version": "3.9.13" 582 | } 583 | }, 584 | "nbformat": 4, 585 | "nbformat_minor": 5 586 | } 587 | -------------------------------------------------------------------------------- /Day 10 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "37d04ef7", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "261899a3", 17 | "metadata": {}, 18 | "source": [ 19 | "# While loop" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 2, 25 | "id": "4a7cac18", 26 | "metadata": {}, 27 | "outputs": [ 28 | { 29 | "name": "stdout", 30 | "output_type": "stream", 31 | "text": [ 32 | "0\n", 33 | "1\n", 34 | "2\n", 35 | "3\n", 36 | "4\n", 37 | "5\n", 38 | "6\n", 39 | "7\n", 40 | "8\n", 41 | "9\n", 42 | "10\n" 43 | ] 44 | } 45 | ], 46 | "source": [ 47 | "i = 0\n", 48 | "while (i<=10):\n", 49 | " print(i)\n", 50 | " i +=1 # i = i+1" 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": 4, 56 | "id": "65757bdf", 57 | "metadata": {}, 58 | "outputs": [ 59 | { 60 | "name": "stdout", 61 | "output_type": "stream", 62 | "text": [ 63 | "0 study mart\n", 64 | "2 study mart\n", 65 | "4 study mart\n", 66 | "6 study mart\n", 67 | "8 study mart\n", 68 | "10 study mart\n" 69 | ] 70 | } 71 | ], 72 | "source": [ 73 | "i = 0\n", 74 | "while (i<=10):\n", 75 | " print(i,'study mart')\n", 76 | " i +=2 " 77 | ] 78 | }, 79 | { 80 | "cell_type": "code", 81 | "execution_count": 5, 82 | "id": "1c333ba8", 83 | "metadata": {}, 84 | "outputs": [ 85 | { 86 | "data": { 87 | "text/plain": [ 88 | "'p'" 89 | ] 90 | }, 91 | "execution_count": 5, 92 | "metadata": {}, 93 | "output_type": "execute_result" 94 | } 95 | ], 96 | "source": [ 97 | "data = 'python'\n", 98 | "data[0]" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": 6, 104 | "id": "8759b7b4", 105 | "metadata": {}, 106 | "outputs": [ 107 | { 108 | "name": "stdout", 109 | "output_type": "stream", 110 | "text": [ 111 | "p\n", 112 | "y\n", 113 | "t\n", 114 | "h\n", 115 | "o\n", 116 | "n\n" 117 | ] 118 | } 119 | ], 120 | "source": [ 121 | "index=0\n", 122 | "while index\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "5f15cfd3", 17 | "metadata": {}, 18 | "source": [ 19 | "# Nested Loop" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 1, 25 | "id": "66dfc25e", 26 | "metadata": {}, 27 | "outputs": [ 28 | { 29 | "name": "stdout", 30 | "output_type": "stream", 31 | "text": [ 32 | "# \n", 33 | "# # \n", 34 | "# # # \n", 35 | "# # # # \n" 36 | ] 37 | } 38 | ], 39 | "source": [ 40 | "rows = 4\n", 41 | "#outer loop\n", 42 | "for x in range(1,rows+1):\n", 43 | " #inner loop\n", 44 | " for y in range(1,x+1):\n", 45 | " print('#', end=' ')\n", 46 | " print('')" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 2, 52 | "id": "4fb2ac73", 53 | "metadata": {}, 54 | "outputs": [ 55 | { 56 | "name": "stdout", 57 | "output_type": "stream", 58 | "text": [ 59 | "1 2 3 4 \n", 60 | "\n", 61 | "1 2 3 4 \n", 62 | "\n", 63 | "1 2 3 4 \n", 64 | "\n", 65 | "1 2 3 4 \n", 66 | "\n" 67 | ] 68 | } 69 | ], 70 | "source": [ 71 | "num = [1,2,3,4]\n", 72 | "\n", 73 | "#outer\n", 74 | "for ele in num:\n", 75 | " #inner\n", 76 | " index=0\n", 77 | " while index\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "32757071", 17 | "metadata": {}, 18 | "source": [ 19 | "# List in Python" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 1, 25 | "id": "f371ccf9", 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "l1 = [2,5,8,10]" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 2, 35 | "id": "26319096", 36 | "metadata": {}, 37 | "outputs": [ 38 | { 39 | "data": { 40 | "text/plain": [ 41 | "[2, 5, 8, 10]" 42 | ] 43 | }, 44 | "execution_count": 2, 45 | "metadata": {}, 46 | "output_type": "execute_result" 47 | } 48 | ], 49 | "source": [ 50 | "l1" 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": 3, 56 | "id": "e553fe0c", 57 | "metadata": {}, 58 | "outputs": [ 59 | { 60 | "data": { 61 | "text/plain": [ 62 | "list" 63 | ] 64 | }, 65 | "execution_count": 3, 66 | "metadata": {}, 67 | "output_type": "execute_result" 68 | } 69 | ], 70 | "source": [ 71 | "type(l1)" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": 4, 77 | "id": "d3ad7ea6", 78 | "metadata": {}, 79 | "outputs": [ 80 | { 81 | "data": { 82 | "text/plain": [ 83 | "2" 84 | ] 85 | }, 86 | "execution_count": 4, 87 | "metadata": {}, 88 | "output_type": "execute_result" 89 | } 90 | ], 91 | "source": [ 92 | "l1[0] #index" 93 | ] 94 | }, 95 | { 96 | "cell_type": "code", 97 | "execution_count": 5, 98 | "id": "549d144d", 99 | "metadata": {}, 100 | "outputs": [ 101 | { 102 | "data": { 103 | "text/plain": [ 104 | "10" 105 | ] 106 | }, 107 | "execution_count": 5, 108 | "metadata": {}, 109 | "output_type": "execute_result" 110 | } 111 | ], 112 | "source": [ 113 | "l1[-1]" 114 | ] 115 | }, 116 | { 117 | "cell_type": "code", 118 | "execution_count": 6, 119 | "id": "9573895a", 120 | "metadata": {}, 121 | "outputs": [ 122 | { 123 | "data": { 124 | "text/plain": [ 125 | "[2, 5]" 126 | ] 127 | }, 128 | "execution_count": 6, 129 | "metadata": {}, 130 | "output_type": "execute_result" 131 | } 132 | ], 133 | "source": [ 134 | "l1[0:2]" 135 | ] 136 | }, 137 | { 138 | "cell_type": "code", 139 | "execution_count": 7, 140 | "id": "443a36fa", 141 | "metadata": {}, 142 | "outputs": [ 143 | { 144 | "data": { 145 | "text/plain": [ 146 | "[2, 5, 8]" 147 | ] 148 | }, 149 | "execution_count": 7, 150 | "metadata": {}, 151 | "output_type": "execute_result" 152 | } 153 | ], 154 | "source": [ 155 | "l1[0:3]" 156 | ] 157 | }, 158 | { 159 | "cell_type": "code", 160 | "execution_count": 8, 161 | "id": "febb1d10", 162 | "metadata": {}, 163 | "outputs": [], 164 | "source": [ 165 | "l1[0] = 'ai quest'" 166 | ] 167 | }, 168 | { 169 | "cell_type": "code", 170 | "execution_count": 9, 171 | "id": "ca884efc", 172 | "metadata": {}, 173 | "outputs": [ 174 | { 175 | "data": { 176 | "text/plain": [ 177 | "['ai quest', 5, 8, 10]" 178 | ] 179 | }, 180 | "execution_count": 9, 181 | "metadata": {}, 182 | "output_type": "execute_result" 183 | } 184 | ], 185 | "source": [ 186 | "l1" 187 | ] 188 | }, 189 | { 190 | "cell_type": "code", 191 | "execution_count": 10, 192 | "id": "805195a4", 193 | "metadata": {}, 194 | "outputs": [ 195 | { 196 | "data": { 197 | "text/plain": [ 198 | "['ai quest', 5, 8, 10]" 199 | ] 200 | }, 201 | "execution_count": 10, 202 | "metadata": {}, 203 | "output_type": "execute_result" 204 | } 205 | ], 206 | "source": [ 207 | "l1" 208 | ] 209 | }, 210 | { 211 | "cell_type": "code", 212 | "execution_count": 11, 213 | "id": "4091f956", 214 | "metadata": {}, 215 | "outputs": [], 216 | "source": [ 217 | "l1.append('study mart')" 218 | ] 219 | }, 220 | { 221 | "cell_type": "code", 222 | "execution_count": 12, 223 | "id": "c2eb69ba", 224 | "metadata": {}, 225 | "outputs": [ 226 | { 227 | "data": { 228 | "text/plain": [ 229 | "['ai quest', 5, 8, 10, 'study mart']" 230 | ] 231 | }, 232 | "execution_count": 12, 233 | "metadata": {}, 234 | "output_type": "execute_result" 235 | } 236 | ], 237 | "source": [ 238 | "l1" 239 | ] 240 | }, 241 | { 242 | "cell_type": "code", 243 | "execution_count": 13, 244 | "id": "19efce0b", 245 | "metadata": {}, 246 | "outputs": [], 247 | "source": [ 248 | "l1.append(5)" 249 | ] 250 | }, 251 | { 252 | "cell_type": "code", 253 | "execution_count": 14, 254 | "id": "cdbb7723", 255 | "metadata": {}, 256 | "outputs": [ 257 | { 258 | "data": { 259 | "text/plain": [ 260 | "['ai quest', 5, 8, 10, 'study mart', 5]" 261 | ] 262 | }, 263 | "execution_count": 14, 264 | "metadata": {}, 265 | "output_type": "execute_result" 266 | } 267 | ], 268 | "source": [ 269 | "l1" 270 | ] 271 | }, 272 | { 273 | "cell_type": "code", 274 | "execution_count": 15, 275 | "id": "56ff2d08", 276 | "metadata": {}, 277 | "outputs": [ 278 | { 279 | "data": { 280 | "text/plain": [ 281 | "120" 282 | ] 283 | }, 284 | "execution_count": 15, 285 | "metadata": {}, 286 | "output_type": "execute_result" 287 | } 288 | ], 289 | "source": [ 290 | "import sys\n", 291 | "sys.getsizeof(l1)" 292 | ] 293 | }, 294 | { 295 | "cell_type": "code", 296 | "execution_count": 16, 297 | "id": "f95f0ca7", 298 | "metadata": {}, 299 | "outputs": [ 300 | { 301 | "data": { 302 | "text/plain": [ 303 | "5" 304 | ] 305 | }, 306 | "execution_count": 16, 307 | "metadata": {}, 308 | "output_type": "execute_result" 309 | } 310 | ], 311 | "source": [ 312 | "l1.pop()" 313 | ] 314 | }, 315 | { 316 | "cell_type": "code", 317 | "execution_count": 17, 318 | "id": "58930a3f", 319 | "metadata": {}, 320 | "outputs": [ 321 | { 322 | "data": { 323 | "text/plain": [ 324 | "['ai quest', 5, 8, 10, 'study mart']" 325 | ] 326 | }, 327 | "execution_count": 17, 328 | "metadata": {}, 329 | "output_type": "execute_result" 330 | } 331 | ], 332 | "source": [ 333 | "l1" 334 | ] 335 | }, 336 | { 337 | "cell_type": "code", 338 | "execution_count": 18, 339 | "id": "b85e7e3f", 340 | "metadata": {}, 341 | "outputs": [ 342 | { 343 | "data": { 344 | "text/plain": [ 345 | "'study mart'" 346 | ] 347 | }, 348 | "execution_count": 18, 349 | "metadata": {}, 350 | "output_type": "execute_result" 351 | } 352 | ], 353 | "source": [ 354 | "l1.pop()" 355 | ] 356 | }, 357 | { 358 | "cell_type": "code", 359 | "execution_count": 19, 360 | "id": "d978766e", 361 | "metadata": {}, 362 | "outputs": [ 363 | { 364 | "data": { 365 | "text/plain": [ 366 | "['ai quest', 5, 8, 10]" 367 | ] 368 | }, 369 | "execution_count": 19, 370 | "metadata": {}, 371 | "output_type": "execute_result" 372 | } 373 | ], 374 | "source": [ 375 | "l1" 376 | ] 377 | }, 378 | { 379 | "cell_type": "code", 380 | "execution_count": 20, 381 | "id": "441e7823", 382 | "metadata": {}, 383 | "outputs": [ 384 | { 385 | "data": { 386 | "text/plain": [ 387 | "'ai quest'" 388 | ] 389 | }, 390 | "execution_count": 20, 391 | "metadata": {}, 392 | "output_type": "execute_result" 393 | } 394 | ], 395 | "source": [ 396 | "l1.pop(0)" 397 | ] 398 | }, 399 | { 400 | "cell_type": "code", 401 | "execution_count": 21, 402 | "id": "127b1683", 403 | "metadata": {}, 404 | "outputs": [ 405 | { 406 | "data": { 407 | "text/plain": [ 408 | "[5, 8, 10]" 409 | ] 410 | }, 411 | "execution_count": 21, 412 | "metadata": {}, 413 | "output_type": "execute_result" 414 | } 415 | ], 416 | "source": [ 417 | "l1" 418 | ] 419 | }, 420 | { 421 | "cell_type": "code", 422 | "execution_count": 22, 423 | "id": "9214c0e5", 424 | "metadata": {}, 425 | "outputs": [], 426 | "source": [ 427 | "#Creating List Using List Constructor\n", 428 | "l2 = list(('ai',12,(1,2,3,4)))" 429 | ] 430 | }, 431 | { 432 | "cell_type": "code", 433 | "execution_count": 23, 434 | "id": "417a8d50", 435 | "metadata": {}, 436 | "outputs": [ 437 | { 438 | "data": { 439 | "text/plain": [ 440 | "['ai', 12, (1, 2, 3, 4)]" 441 | ] 442 | }, 443 | "execution_count": 23, 444 | "metadata": {}, 445 | "output_type": "execute_result" 446 | } 447 | ], 448 | "source": [ 449 | "l2" 450 | ] 451 | }, 452 | { 453 | "cell_type": "code", 454 | "execution_count": 24, 455 | "id": "97bb1ec4", 456 | "metadata": {}, 457 | "outputs": [ 458 | { 459 | "data": { 460 | "text/plain": [ 461 | "list" 462 | ] 463 | }, 464 | "execution_count": 24, 465 | "metadata": {}, 466 | "output_type": "execute_result" 467 | } 468 | ], 469 | "source": [ 470 | "type(l2)" 471 | ] 472 | }, 473 | { 474 | "cell_type": "code", 475 | "execution_count": 25, 476 | "id": "dee6e773", 477 | "metadata": {}, 478 | "outputs": [ 479 | { 480 | "data": { 481 | "text/plain": [ 482 | "(1, 2, 3, 4)" 483 | ] 484 | }, 485 | "execution_count": 25, 486 | "metadata": {}, 487 | "output_type": "execute_result" 488 | } 489 | ], 490 | "source": [ 491 | "l2[2]" 492 | ] 493 | }, 494 | { 495 | "cell_type": "code", 496 | "execution_count": 26, 497 | "id": "1897540a", 498 | "metadata": {}, 499 | "outputs": [ 500 | { 501 | "data": { 502 | "text/plain": [ 503 | "1" 504 | ] 505 | }, 506 | "execution_count": 26, 507 | "metadata": {}, 508 | "output_type": "execute_result" 509 | } 510 | ], 511 | "source": [ 512 | "l2[2][0]" 513 | ] 514 | }, 515 | { 516 | "cell_type": "code", 517 | "execution_count": 27, 518 | "id": "68669dbe", 519 | "metadata": {}, 520 | "outputs": [ 521 | { 522 | "name": "stdout", 523 | "output_type": "stream", 524 | "text": [ 525 | "Enter your total index: 3\n", 526 | "1\n", 527 | "['1']\n", 528 | "2\n", 529 | "['1', '2']\n", 530 | "3\n", 531 | "['1', '2', '3']\n" 532 | ] 533 | } 534 | ], 535 | "source": [ 536 | "#input list from user\n", 537 | "l3 = []\n", 538 | "n = int(input('Enter your total index: '))\n", 539 | "\n", 540 | "for i in range(n):\n", 541 | " new = input()\n", 542 | " l3.append(new)\n", 543 | " print(l3)" 544 | ] 545 | }, 546 | { 547 | "cell_type": "code", 548 | "execution_count": 28, 549 | "id": "183b6df4", 550 | "metadata": {}, 551 | "outputs": [ 552 | { 553 | "name": "stdout", 554 | "output_type": "stream", 555 | "text": [ 556 | "Enter your total index: 3\n", 557 | "200\n", 558 | "33\n", 559 | "10\n", 560 | "['200', '33', '10']\n" 561 | ] 562 | } 563 | ], 564 | "source": [ 565 | "#input list from user\n", 566 | "l3 = []\n", 567 | "n = int(input('Enter your total index: '))\n", 568 | "\n", 569 | "for i in range(n):\n", 570 | " new = input()\n", 571 | " l3.append(new)\n", 572 | "print(l3) # final" 573 | ] 574 | }, 575 | { 576 | "cell_type": "code", 577 | "execution_count": 29, 578 | "id": "3d3f2ea3", 579 | "metadata": {}, 580 | "outputs": [ 581 | { 582 | "data": { 583 | "text/plain": [ 584 | "list" 585 | ] 586 | }, 587 | "execution_count": 29, 588 | "metadata": {}, 589 | "output_type": "execute_result" 590 | } 591 | ], 592 | "source": [ 593 | "type(l3)" 594 | ] 595 | }, 596 | { 597 | "cell_type": "code", 598 | "execution_count": null, 599 | "id": "856d1df6", 600 | "metadata": {}, 601 | "outputs": [], 602 | "source": [] 603 | } 604 | ], 605 | "metadata": { 606 | "kernelspec": { 607 | "display_name": "Python 3 (ipykernel)", 608 | "language": "python", 609 | "name": "python3" 610 | }, 611 | "language_info": { 612 | "codemirror_mode": { 613 | "name": "ipython", 614 | "version": 3 615 | }, 616 | "file_extension": ".py", 617 | "mimetype": "text/x-python", 618 | "name": "python", 619 | "nbconvert_exporter": "python", 620 | "pygments_lexer": "ipython3", 621 | "version": "3.9.13" 622 | } 623 | }, 624 | "nbformat": 4, 625 | "nbformat_minor": 5 626 | } 627 | -------------------------------------------------------------------------------- /Day 14 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "bc565d97", 6 | "metadata": {}, 7 | "source": [ 8 | "# List Comprehension: Elegant Way to Create List in Python\n", 9 | "\n", 10 | "List comprehensions provide a concise way to create lists in Python. It is a powerful feature that allows you to generate lists in a single line of code, making your code more readable and expressive.\n", 11 | "\n", 12 | "## Basic Syntax\n", 13 | "\n", 14 | "The basic syntax of a list comprehension is:\n", 15 | "\n", 16 | "```python\n", 17 | "[expression for item in iterable if condition]\n" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "id": "116ea9d9", 23 | "metadata": {}, 24 | "source": [ 25 | "1. expression: The expression to evaluate for each item in the iterable.\n", 26 | "2. item: The current item in the iterable.\n", 27 | "3. iterable: A collection of items.\n", 28 | "4. condition (optional): A conditional filter that can be applied to the items." 29 | ] 30 | }, 31 | { 32 | "cell_type": "markdown", 33 | "id": "681f4ec8", 34 | "metadata": {}, 35 | "source": [ 36 | "# Simple List Comprehension\n", 37 | "Let's start with a simple example: creating a list of squares for numbers from 0 to 9." 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": 1, 43 | "id": "7a02cc08", 44 | "metadata": {}, 45 | "outputs": [ 46 | { 47 | "name": "stdout", 48 | "output_type": "stream", 49 | "text": [ 50 | "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]\n" 51 | ] 52 | } 53 | ], 54 | "source": [ 55 | "squares = [x**2 for x in range(10)]\n", 56 | "print(squares)" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": 2, 62 | "id": "2b73c75a", 63 | "metadata": {}, 64 | "outputs": [ 65 | { 66 | "data": { 67 | "text/plain": [ 68 | "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]" 69 | ] 70 | }, 71 | "execution_count": 2, 72 | "metadata": {}, 73 | "output_type": "execute_result" 74 | } 75 | ], 76 | "source": [ 77 | "[ x for x in range(10)]" 78 | ] 79 | }, 80 | { 81 | "cell_type": "code", 82 | "execution_count": 3, 83 | "id": "567b34c0", 84 | "metadata": {}, 85 | "outputs": [ 86 | { 87 | "name": "stdout", 88 | "output_type": "stream", 89 | "text": [ 90 | "0\n", 91 | "1\n", 92 | "2\n", 93 | "3\n", 94 | "4\n", 95 | "5\n", 96 | "6\n", 97 | "7\n", 98 | "8\n", 99 | "9\n" 100 | ] 101 | } 102 | ], 103 | "source": [ 104 | "for x in range(10):\n", 105 | " print(x)" 106 | ] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "id": "f42b7dbd", 111 | "metadata": {}, 112 | "source": [ 113 | "# List Comprehension with Condition\n", 114 | "You can add a condition to the list comprehension to filter items. For example, creating a list of even numbers from 0 to 9:" 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "execution_count": 4, 120 | "id": "d37bb4f9", 121 | "metadata": {}, 122 | "outputs": [ 123 | { 124 | "name": "stdout", 125 | "output_type": "stream", 126 | "text": [ 127 | "[0, 2, 4, 6, 8]\n" 128 | ] 129 | } 130 | ], 131 | "source": [ 132 | "evens = [x for x in range(10) if x % 2 == 0]\n", 133 | "print(evens)" 134 | ] 135 | }, 136 | { 137 | "cell_type": "code", 138 | "execution_count": 5, 139 | "id": "f9f7d45d", 140 | "metadata": {}, 141 | "outputs": [ 142 | { 143 | "data": { 144 | "text/plain": [ 145 | "['I',\n", 146 | " ' ',\n", 147 | " 'l',\n", 148 | " 'o',\n", 149 | " 'v',\n", 150 | " 'e',\n", 151 | " ' ',\n", 152 | " 'd',\n", 153 | " 'a',\n", 154 | " 't',\n", 155 | " 'a',\n", 156 | " ' ',\n", 157 | " 's',\n", 158 | " 'c',\n", 159 | " 'i',\n", 160 | " 'e',\n", 161 | " 'n',\n", 162 | " 'c',\n", 163 | " 'e']" 164 | ] 165 | }, 166 | "execution_count": 5, 167 | "metadata": {}, 168 | "output_type": "execute_result" 169 | } 170 | ], 171 | "source": [ 172 | "data = 'I love data science'\n", 173 | "[ x for x in data]" 174 | ] 175 | }, 176 | { 177 | "cell_type": "code", 178 | "execution_count": 6, 179 | "id": "06d360fd", 180 | "metadata": {}, 181 | "outputs": [ 182 | { 183 | "data": { 184 | "text/plain": [ 185 | "['love', 'data', 'science']" 186 | ] 187 | }, 188 | "execution_count": 6, 189 | "metadata": {}, 190 | "output_type": "execute_result" 191 | } 192 | ], 193 | "source": [ 194 | "data = 'I love data science'\n", 195 | "data = data.split()\n", 196 | "[ x for x in data if x!='I']" 197 | ] 198 | }, 199 | { 200 | "cell_type": "markdown", 201 | "id": "3b2e4128", 202 | "metadata": {}, 203 | "source": [ 204 | "# Creating a Matrix Using List Comprehension in Python\n", 205 | "\n", 206 | "List comprehensions can be used to create complex data structures efficiently and concisely. Below is an example of using nested list comprehensions to create a matrix.\n", 207 | "\n", 208 | "```python\n", 209 | "matrix = [[j for j in range(5)] for i in range(3)]\n", 210 | "print(matrix)\n" 211 | ] 212 | }, 213 | { 214 | "cell_type": "code", 215 | "execution_count": 7, 216 | "id": "81760b8a", 217 | "metadata": {}, 218 | "outputs": [ 219 | { 220 | "name": "stdout", 221 | "output_type": "stream", 222 | "text": [ 223 | "[[0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4]]\n" 224 | ] 225 | } 226 | ], 227 | "source": [ 228 | "matrix = [[j for j in range(5)] for i in range(3)]\n", 229 | "print(matrix)" 230 | ] 231 | }, 232 | { 233 | "cell_type": "markdown", 234 | "id": "2853d6a1", 235 | "metadata": {}, 236 | "source": [ 237 | "# Using Functions in List Comprehensions\n", 238 | "You can also use functions within list comprehensions. For example, creating a list of lengths of each word in a list:" 239 | ] 240 | }, 241 | { 242 | "cell_type": "code", 243 | "execution_count": 8, 244 | "id": "bd11d942", 245 | "metadata": {}, 246 | "outputs": [ 247 | { 248 | "name": "stdout", 249 | "output_type": "stream", 250 | "text": [ 251 | "[6, 4, 13, 7]\n" 252 | ] 253 | } 254 | ], 255 | "source": [ 256 | "words = [\"Python\", \"List\", \"Comprehension\", \"Example\"]\n", 257 | "lengths = [len(word) for word in words]\n", 258 | "print(lengths)" 259 | ] 260 | }, 261 | { 262 | "cell_type": "code", 263 | "execution_count": null, 264 | "id": "7ea9d48e", 265 | "metadata": {}, 266 | "outputs": [], 267 | "source": [] 268 | }, 269 | { 270 | "cell_type": "code", 271 | "execution_count": null, 272 | "id": "e1def2c6", 273 | "metadata": {}, 274 | "outputs": [], 275 | "source": [] 276 | } 277 | ], 278 | "metadata": { 279 | "kernelspec": { 280 | "display_name": "Python 3 (ipykernel)", 281 | "language": "python", 282 | "name": "python3" 283 | }, 284 | "language_info": { 285 | "codemirror_mode": { 286 | "name": "ipython", 287 | "version": 3 288 | }, 289 | "file_extension": ".py", 290 | "mimetype": "text/x-python", 291 | "name": "python", 292 | "nbconvert_exporter": "python", 293 | "pygments_lexer": "ipython3", 294 | "version": "3.9.13" 295 | } 296 | }, 297 | "nbformat": 4, 298 | "nbformat_minor": 5 299 | } 300 | -------------------------------------------------------------------------------- /Day 17 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "c13d782b", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "971fa171", 17 | "metadata": {}, 18 | "source": [ 19 | "# Set in Python" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 1, 25 | "id": "28b976c7", 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "set1 = {1,2,3,4,'ai',(1,7,10)}" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 2, 35 | "id": "2f0745f1", 36 | "metadata": {}, 37 | "outputs": [ 38 | { 39 | "data": { 40 | "text/plain": [ 41 | "{(1, 7, 10), 1, 2, 3, 4, 'ai'}" 42 | ] 43 | }, 44 | "execution_count": 2, 45 | "metadata": {}, 46 | "output_type": "execute_result" 47 | } 48 | ], 49 | "source": [ 50 | "set1" 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": 3, 56 | "id": "bb8acd71", 57 | "metadata": {}, 58 | "outputs": [ 59 | { 60 | "data": { 61 | "text/plain": [ 62 | "set" 63 | ] 64 | }, 65 | "execution_count": 3, 66 | "metadata": {}, 67 | "output_type": "execute_result" 68 | } 69 | ], 70 | "source": [ 71 | "type(set1)" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": 4, 77 | "id": "dbe0ffff", 78 | "metadata": {}, 79 | "outputs": [], 80 | "source": [ 81 | "set2 = {}\n", 82 | "li = []" 83 | ] 84 | }, 85 | { 86 | "cell_type": "code", 87 | "execution_count": 5, 88 | "id": "d99bbbfd", 89 | "metadata": {}, 90 | "outputs": [ 91 | { 92 | "data": { 93 | "text/plain": [ 94 | "list" 95 | ] 96 | }, 97 | "execution_count": 5, 98 | "metadata": {}, 99 | "output_type": "execute_result" 100 | } 101 | ], 102 | "source": [ 103 | "type(li)" 104 | ] 105 | }, 106 | { 107 | "cell_type": "code", 108 | "execution_count": 6, 109 | "id": "634523f2", 110 | "metadata": {}, 111 | "outputs": [ 112 | { 113 | "data": { 114 | "text/plain": [ 115 | "dict" 116 | ] 117 | }, 118 | "execution_count": 6, 119 | "metadata": {}, 120 | "output_type": "execute_result" 121 | } 122 | ], 123 | "source": [ 124 | "type(set2)" 125 | ] 126 | }, 127 | { 128 | "cell_type": "code", 129 | "execution_count": 7, 130 | "id": "1bfb2649", 131 | "metadata": {}, 132 | "outputs": [], 133 | "source": [ 134 | "set3 = set()" 135 | ] 136 | }, 137 | { 138 | "cell_type": "code", 139 | "execution_count": 8, 140 | "id": "d0eea124", 141 | "metadata": {}, 142 | "outputs": [ 143 | { 144 | "data": { 145 | "text/plain": [ 146 | "set" 147 | ] 148 | }, 149 | "execution_count": 8, 150 | "metadata": {}, 151 | "output_type": "execute_result" 152 | } 153 | ], 154 | "source": [ 155 | "type(set3)" 156 | ] 157 | }, 158 | { 159 | "cell_type": "code", 160 | "execution_count": 9, 161 | "id": "79f704e3", 162 | "metadata": {}, 163 | "outputs": [ 164 | { 165 | "data": { 166 | "text/plain": [ 167 | "set()" 168 | ] 169 | }, 170 | "execution_count": 9, 171 | "metadata": {}, 172 | "output_type": "execute_result" 173 | } 174 | ], 175 | "source": [ 176 | "set3" 177 | ] 178 | }, 179 | { 180 | "cell_type": "code", 181 | "execution_count": 10, 182 | "id": "0499e299", 183 | "metadata": {}, 184 | "outputs": [ 185 | { 186 | "data": { 187 | "text/plain": [ 188 | "[]" 189 | ] 190 | }, 191 | "execution_count": 10, 192 | "metadata": {}, 193 | "output_type": "execute_result" 194 | } 195 | ], 196 | "source": [ 197 | "li" 198 | ] 199 | }, 200 | { 201 | "cell_type": "code", 202 | "execution_count": 11, 203 | "id": "af5380ef", 204 | "metadata": {}, 205 | "outputs": [ 206 | { 207 | "data": { 208 | "text/plain": [ 209 | "{(1, 7, 10), 1, 2, 3, 4, 'ai'}" 210 | ] 211 | }, 212 | "execution_count": 11, 213 | "metadata": {}, 214 | "output_type": "execute_result" 215 | } 216 | ], 217 | "source": [ 218 | "set1" 219 | ] 220 | }, 221 | { 222 | "cell_type": "code", 223 | "execution_count": 12, 224 | "id": "960a038f", 225 | "metadata": {}, 226 | "outputs": [ 227 | { 228 | "ename": "TypeError", 229 | "evalue": "'set' object is not subscriptable", 230 | "output_type": "error", 231 | "traceback": [ 232 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 233 | "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", 234 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mset1\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", 235 | "\u001b[1;31mTypeError\u001b[0m: 'set' object is not subscriptable" 236 | ] 237 | } 238 | ], 239 | "source": [ 240 | "set1[0]" 241 | ] 242 | }, 243 | { 244 | "cell_type": "code", 245 | "execution_count": 13, 246 | "id": "5039b0b8", 247 | "metadata": {}, 248 | "outputs": [], 249 | "source": [ 250 | "set1.add(100)" 251 | ] 252 | }, 253 | { 254 | "cell_type": "code", 255 | "execution_count": 14, 256 | "id": "b9d8db20", 257 | "metadata": {}, 258 | "outputs": [ 259 | { 260 | "data": { 261 | "text/plain": [ 262 | "{(1, 7, 10), 1, 100, 2, 3, 4, 'ai'}" 263 | ] 264 | }, 265 | "execution_count": 14, 266 | "metadata": {}, 267 | "output_type": "execute_result" 268 | } 269 | ], 270 | "source": [ 271 | "set1" 272 | ] 273 | }, 274 | { 275 | "cell_type": "code", 276 | "execution_count": 18, 277 | "id": "35e6f56c", 278 | "metadata": {}, 279 | "outputs": [], 280 | "source": [ 281 | "set1.update([10,20,1000,4000])" 282 | ] 283 | }, 284 | { 285 | "cell_type": "code", 286 | "execution_count": 19, 287 | "id": "34c0b946", 288 | "metadata": {}, 289 | "outputs": [ 290 | { 291 | "data": { 292 | "text/plain": [ 293 | "{(1, 7, 10), 1, 10, 100, 1000, 2, 20, 3, 4, 4000, 'ai'}" 294 | ] 295 | }, 296 | "execution_count": 19, 297 | "metadata": {}, 298 | "output_type": "execute_result" 299 | } 300 | ], 301 | "source": [ 302 | "set1" 303 | ] 304 | }, 305 | { 306 | "cell_type": "code", 307 | "execution_count": 20, 308 | "id": "532039a2", 309 | "metadata": {}, 310 | "outputs": [], 311 | "source": [ 312 | "set1.add(100)" 313 | ] 314 | }, 315 | { 316 | "cell_type": "code", 317 | "execution_count": 21, 318 | "id": "7124b2fc", 319 | "metadata": {}, 320 | "outputs": [ 321 | { 322 | "data": { 323 | "text/plain": [ 324 | "{(1, 7, 10), 1, 10, 100, 1000, 2, 20, 3, 4, 4000, 'ai'}" 325 | ] 326 | }, 327 | "execution_count": 21, 328 | "metadata": {}, 329 | "output_type": "execute_result" 330 | } 331 | ], 332 | "source": [ 333 | "set1" 334 | ] 335 | }, 336 | { 337 | "cell_type": "code", 338 | "execution_count": 22, 339 | "id": "cc9dd37b", 340 | "metadata": {}, 341 | "outputs": [], 342 | "source": [ 343 | "set1.remove('ai')" 344 | ] 345 | }, 346 | { 347 | "cell_type": "code", 348 | "execution_count": 23, 349 | "id": "476413f7", 350 | "metadata": {}, 351 | "outputs": [ 352 | { 353 | "data": { 354 | "text/plain": [ 355 | "{(1, 7, 10), 1, 10, 100, 1000, 2, 20, 3, 4, 4000}" 356 | ] 357 | }, 358 | "execution_count": 23, 359 | "metadata": {}, 360 | "output_type": "execute_result" 361 | } 362 | ], 363 | "source": [ 364 | "set1" 365 | ] 366 | }, 367 | { 368 | "cell_type": "code", 369 | "execution_count": 25, 370 | "id": "2623244d", 371 | "metadata": {}, 372 | "outputs": [], 373 | "source": [ 374 | "set1.remove(1)" 375 | ] 376 | }, 377 | { 378 | "cell_type": "code", 379 | "execution_count": 26, 380 | "id": "caaaecc3", 381 | "metadata": {}, 382 | "outputs": [ 383 | { 384 | "data": { 385 | "text/plain": [ 386 | "{(1, 7, 10), 10, 100, 1000, 2, 20, 3, 4, 4000}" 387 | ] 388 | }, 389 | "execution_count": 26, 390 | "metadata": {}, 391 | "output_type": "execute_result" 392 | } 393 | ], 394 | "source": [ 395 | "set1" 396 | ] 397 | }, 398 | { 399 | "cell_type": "code", 400 | "execution_count": 27, 401 | "id": "16297bf8", 402 | "metadata": {}, 403 | "outputs": [], 404 | "source": [ 405 | "set1.discard(10)" 406 | ] 407 | }, 408 | { 409 | "cell_type": "code", 410 | "execution_count": 28, 411 | "id": "78e8ac6d", 412 | "metadata": {}, 413 | "outputs": [ 414 | { 415 | "ename": "KeyError", 416 | "evalue": "10", 417 | "output_type": "error", 418 | "traceback": [ 419 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 420 | "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", 421 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mset1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mremove\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m10\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", 422 | "\u001b[1;31mKeyError\u001b[0m: 10" 423 | ] 424 | } 425 | ], 426 | "source": [ 427 | "set1.remove(10)" 428 | ] 429 | }, 430 | { 431 | "cell_type": "code", 432 | "execution_count": 29, 433 | "id": "a8e3d6af", 434 | "metadata": {}, 435 | "outputs": [], 436 | "source": [ 437 | "set1.discard(10)" 438 | ] 439 | }, 440 | { 441 | "cell_type": "code", 442 | "execution_count": 30, 443 | "id": "a75263c6", 444 | "metadata": {}, 445 | "outputs": [ 446 | { 447 | "data": { 448 | "text/plain": [ 449 | "{(1, 7, 10), 100, 1000, 2, 20, 3, 4, 4000}" 450 | ] 451 | }, 452 | "execution_count": 30, 453 | "metadata": {}, 454 | "output_type": "execute_result" 455 | } 456 | ], 457 | "source": [ 458 | "set1" 459 | ] 460 | }, 461 | { 462 | "cell_type": "code", 463 | "execution_count": 31, 464 | "id": "a5eab948", 465 | "metadata": {}, 466 | "outputs": [], 467 | "source": [ 468 | "set1.discard(10)" 469 | ] 470 | }, 471 | { 472 | "cell_type": "code", 473 | "execution_count": 32, 474 | "id": "a069efba", 475 | "metadata": {}, 476 | "outputs": [ 477 | { 478 | "data": { 479 | "text/plain": [ 480 | "{(1, 7, 10), 100, 1000, 2, 20, 3, 4, 4000}" 481 | ] 482 | }, 483 | "execution_count": 32, 484 | "metadata": {}, 485 | "output_type": "execute_result" 486 | } 487 | ], 488 | "source": [ 489 | "set1" 490 | ] 491 | }, 492 | { 493 | "cell_type": "code", 494 | "execution_count": 33, 495 | "id": "e5fe160c", 496 | "metadata": {}, 497 | "outputs": [ 498 | { 499 | "data": { 500 | "text/plain": [ 501 | "True" 502 | ] 503 | }, 504 | "execution_count": 33, 505 | "metadata": {}, 506 | "output_type": "execute_result" 507 | } 508 | ], 509 | "source": [ 510 | "2 in set1" 511 | ] 512 | }, 513 | { 514 | "cell_type": "code", 515 | "execution_count": 35, 516 | "id": "8a5d4e37", 517 | "metadata": {}, 518 | "outputs": [], 519 | "source": [ 520 | "set1.clear()" 521 | ] 522 | }, 523 | { 524 | "cell_type": "code", 525 | "execution_count": 36, 526 | "id": "b63a7bc8", 527 | "metadata": {}, 528 | "outputs": [ 529 | { 530 | "data": { 531 | "text/plain": [ 532 | "set()" 533 | ] 534 | }, 535 | "execution_count": 36, 536 | "metadata": {}, 537 | "output_type": "execute_result" 538 | } 539 | ], 540 | "source": [ 541 | "set1" 542 | ] 543 | }, 544 | { 545 | "cell_type": "code", 546 | "execution_count": 40, 547 | "id": "defe0c73", 548 | "metadata": {}, 549 | "outputs": [], 550 | "source": [ 551 | "set2 = {2,3,4,4}" 552 | ] 553 | }, 554 | { 555 | "cell_type": "code", 556 | "execution_count": 41, 557 | "id": "7e321e24", 558 | "metadata": {}, 559 | "outputs": [ 560 | { 561 | "data": { 562 | "text/plain": [ 563 | "2" 564 | ] 565 | }, 566 | "execution_count": 41, 567 | "metadata": {}, 568 | "output_type": "execute_result" 569 | } 570 | ], 571 | "source": [ 572 | "set2.pop()" 573 | ] 574 | }, 575 | { 576 | "cell_type": "code", 577 | "execution_count": 43, 578 | "id": "a3707e90", 579 | "metadata": {}, 580 | "outputs": [ 581 | { 582 | "data": { 583 | "text/plain": [ 584 | "3" 585 | ] 586 | }, 587 | "execution_count": 43, 588 | "metadata": {}, 589 | "output_type": "execute_result" 590 | } 591 | ], 592 | "source": [ 593 | "set2.pop()" 594 | ] 595 | }, 596 | { 597 | "cell_type": "code", 598 | "execution_count": 44, 599 | "id": "79c360bf", 600 | "metadata": {}, 601 | "outputs": [ 602 | { 603 | "data": { 604 | "text/plain": [ 605 | "{4}" 606 | ] 607 | }, 608 | "execution_count": 44, 609 | "metadata": {}, 610 | "output_type": "execute_result" 611 | } 612 | ], 613 | "source": [ 614 | "set2" 615 | ] 616 | }, 617 | { 618 | "cell_type": "code", 619 | "execution_count": null, 620 | "id": "687409ef", 621 | "metadata": {}, 622 | "outputs": [], 623 | "source": [] 624 | } 625 | ], 626 | "metadata": { 627 | "kernelspec": { 628 | "display_name": "Python 3 (ipykernel)", 629 | "language": "python", 630 | "name": "python3" 631 | }, 632 | "language_info": { 633 | "codemirror_mode": { 634 | "name": "ipython", 635 | "version": 3 636 | }, 637 | "file_extension": ".py", 638 | "mimetype": "text/x-python", 639 | "name": "python", 640 | "nbconvert_exporter": "python", 641 | "pygments_lexer": "ipython3", 642 | "version": "3.9.13" 643 | } 644 | }, 645 | "nbformat": 4, 646 | "nbformat_minor": 5 647 | } 648 | -------------------------------------------------------------------------------- /Day 18 - 60 Days of Pythonn.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "22f29030", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 1, 17 | "id": "de20bc36", 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "#FrozenSet()\n", 22 | "s1 = {1,2,3,4,5}\n", 23 | "s2 = {'a','b'}" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 2, 29 | "id": "efc161ab", 30 | "metadata": {}, 31 | "outputs": [ 32 | { 33 | "data": { 34 | "text/plain": [ 35 | "{1, 2, 3, 4, 5}" 36 | ] 37 | }, 38 | "execution_count": 2, 39 | "metadata": {}, 40 | "output_type": "execute_result" 41 | } 42 | ], 43 | "source": [ 44 | "s1" 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": 3, 50 | "id": "5b32a7be", 51 | "metadata": {}, 52 | "outputs": [ 53 | { 54 | "data": { 55 | "text/plain": [ 56 | "{'a', 'b'}" 57 | ] 58 | }, 59 | "execution_count": 3, 60 | "metadata": {}, 61 | "output_type": "execute_result" 62 | } 63 | ], 64 | "source": [ 65 | "s2" 66 | ] 67 | }, 68 | { 69 | "cell_type": "code", 70 | "execution_count": 4, 71 | "id": "a19012de", 72 | "metadata": {}, 73 | "outputs": [ 74 | { 75 | "data": { 76 | "text/plain": [ 77 | "set" 78 | ] 79 | }, 80 | "execution_count": 4, 81 | "metadata": {}, 82 | "output_type": "execute_result" 83 | } 84 | ], 85 | "source": [ 86 | "type(s1)" 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "execution_count": 5, 92 | "id": "c03b3f8b", 93 | "metadata": {}, 94 | "outputs": [], 95 | "source": [ 96 | "s1.add(10)" 97 | ] 98 | }, 99 | { 100 | "cell_type": "code", 101 | "execution_count": 6, 102 | "id": "803f9366", 103 | "metadata": {}, 104 | "outputs": [ 105 | { 106 | "data": { 107 | "text/plain": [ 108 | "{1, 2, 3, 4, 5, 10}" 109 | ] 110 | }, 111 | "execution_count": 6, 112 | "metadata": {}, 113 | "output_type": "execute_result" 114 | } 115 | ], 116 | "source": [ 117 | "s1" 118 | ] 119 | }, 120 | { 121 | "cell_type": "markdown", 122 | "id": "de9d6aa8", 123 | "metadata": {}, 124 | "source": [ 125 | "# FrozenSet()" 126 | ] 127 | }, 128 | { 129 | "cell_type": "code", 130 | "execution_count": 7, 131 | "id": "234a948c", 132 | "metadata": {}, 133 | "outputs": [ 134 | { 135 | "data": { 136 | "text/plain": [ 137 | "frozenset({1, 2, 3, 4, 5, 10})" 138 | ] 139 | }, 140 | "execution_count": 7, 141 | "metadata": {}, 142 | "output_type": "execute_result" 143 | } 144 | ], 145 | "source": [ 146 | "s3 = frozenset(s1)\n", 147 | "s3" 148 | ] 149 | }, 150 | { 151 | "cell_type": "code", 152 | "execution_count": 8, 153 | "id": "a9199c6b", 154 | "metadata": {}, 155 | "outputs": [ 156 | { 157 | "data": { 158 | "text/plain": [ 159 | "frozenset" 160 | ] 161 | }, 162 | "execution_count": 8, 163 | "metadata": {}, 164 | "output_type": "execute_result" 165 | } 166 | ], 167 | "source": [ 168 | "type(s3)" 169 | ] 170 | }, 171 | { 172 | "cell_type": "code", 173 | "execution_count": 9, 174 | "id": "60602a88", 175 | "metadata": {}, 176 | "outputs": [ 177 | { 178 | "ename": "AttributeError", 179 | "evalue": "'frozenset' object has no attribute 'add'", 180 | "output_type": "error", 181 | "traceback": [ 182 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 183 | "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", 184 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ms3\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0madd\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m11\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", 185 | "\u001b[1;31mAttributeError\u001b[0m: 'frozenset' object has no attribute 'add'" 186 | ] 187 | } 188 | ], 189 | "source": [ 190 | "s3.add(11)" 191 | ] 192 | }, 193 | { 194 | "cell_type": "code", 195 | "execution_count": 10, 196 | "id": "7a7c0c78", 197 | "metadata": {}, 198 | "outputs": [ 199 | { 200 | "ename": "AttributeError", 201 | "evalue": "'frozenset' object has no attribute 'remove'", 202 | "output_type": "error", 203 | "traceback": [ 204 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 205 | "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", 206 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ms3\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mremove\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", 207 | "\u001b[1;31mAttributeError\u001b[0m: 'frozenset' object has no attribute 'remove'" 208 | ] 209 | } 210 | ], 211 | "source": [ 212 | "s3.remove(5)" 213 | ] 214 | }, 215 | { 216 | "cell_type": "code", 217 | "execution_count": 11, 218 | "id": "e7715006", 219 | "metadata": {}, 220 | "outputs": [], 221 | "source": [ 222 | "l1 = [1,2,3,4,15]" 223 | ] 224 | }, 225 | { 226 | "cell_type": "code", 227 | "execution_count": 12, 228 | "id": "d9bfc9b4", 229 | "metadata": {}, 230 | "outputs": [], 231 | "source": [ 232 | "s4 = frozenset(l1)" 233 | ] 234 | }, 235 | { 236 | "cell_type": "code", 237 | "execution_count": 13, 238 | "id": "78527756", 239 | "metadata": {}, 240 | "outputs": [ 241 | { 242 | "data": { 243 | "text/plain": [ 244 | "frozenset({1, 2, 3, 4, 15})" 245 | ] 246 | }, 247 | "execution_count": 13, 248 | "metadata": {}, 249 | "output_type": "execute_result" 250 | } 251 | ], 252 | "source": [ 253 | "s4" 254 | ] 255 | }, 256 | { 257 | "cell_type": "code", 258 | "execution_count": 14, 259 | "id": "59c71c9c", 260 | "metadata": {}, 261 | "outputs": [ 262 | { 263 | "ename": "TypeError", 264 | "evalue": "'frozenset' object is not subscriptable", 265 | "output_type": "error", 266 | "traceback": [ 267 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 268 | "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", 269 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ms4\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", 270 | "\u001b[1;31mTypeError\u001b[0m: 'frozenset' object is not subscriptable" 271 | ] 272 | } 273 | ], 274 | "source": [ 275 | "s4[0]" 276 | ] 277 | }, 278 | { 279 | "cell_type": "code", 280 | "execution_count": 15, 281 | "id": "d6c96855", 282 | "metadata": {}, 283 | "outputs": [ 284 | { 285 | "data": { 286 | "text/plain": [ 287 | "1" 288 | ] 289 | }, 290 | "execution_count": 15, 291 | "metadata": {}, 292 | "output_type": "execute_result" 293 | } 294 | ], 295 | "source": [ 296 | "l1[0]" 297 | ] 298 | }, 299 | { 300 | "cell_type": "code", 301 | "execution_count": 16, 302 | "id": "3c972b0b", 303 | "metadata": {}, 304 | "outputs": [ 305 | { 306 | "data": { 307 | "text/plain": [ 308 | "frozenset({1, 2, 3, 4, 5, 10})" 309 | ] 310 | }, 311 | "execution_count": 16, 312 | "metadata": {}, 313 | "output_type": "execute_result" 314 | } 315 | ], 316 | "source": [ 317 | "s3" 318 | ] 319 | }, 320 | { 321 | "cell_type": "code", 322 | "execution_count": 17, 323 | "id": "3d12885b", 324 | "metadata": {}, 325 | "outputs": [ 326 | { 327 | "data": { 328 | "text/plain": [ 329 | "frozenset({1, 2, 3, 4, 15})" 330 | ] 331 | }, 332 | "execution_count": 17, 333 | "metadata": {}, 334 | "output_type": "execute_result" 335 | } 336 | ], 337 | "source": [ 338 | "s4" 339 | ] 340 | }, 341 | { 342 | "cell_type": "code", 343 | "execution_count": 18, 344 | "id": "9c465c21", 345 | "metadata": {}, 346 | "outputs": [ 347 | { 348 | "data": { 349 | "text/plain": [ 350 | "frozenset({1, 2, 3, 4, 5, 10, 15})" 351 | ] 352 | }, 353 | "execution_count": 18, 354 | "metadata": {}, 355 | "output_type": "execute_result" 356 | } 357 | ], 358 | "source": [ 359 | "s3.union(s4)" 360 | ] 361 | }, 362 | { 363 | "cell_type": "code", 364 | "execution_count": 19, 365 | "id": "d555316a", 366 | "metadata": {}, 367 | "outputs": [ 368 | { 369 | "data": { 370 | "text/plain": [ 371 | "frozenset({1, 2, 3, 4})" 372 | ] 373 | }, 374 | "execution_count": 19, 375 | "metadata": {}, 376 | "output_type": "execute_result" 377 | } 378 | ], 379 | "source": [ 380 | "s3.intersection(s4)" 381 | ] 382 | }, 383 | { 384 | "cell_type": "code", 385 | "execution_count": 20, 386 | "id": "627ffe7c", 387 | "metadata": {}, 388 | "outputs": [], 389 | "source": [ 390 | "s = 'data science'" 391 | ] 392 | }, 393 | { 394 | "cell_type": "code", 395 | "execution_count": 21, 396 | "id": "a6aba0af", 397 | "metadata": {}, 398 | "outputs": [ 399 | { 400 | "data": { 401 | "text/plain": [ 402 | "'data science'" 403 | ] 404 | }, 405 | "execution_count": 21, 406 | "metadata": {}, 407 | "output_type": "execute_result" 408 | } 409 | ], 410 | "source": [ 411 | "s" 412 | ] 413 | }, 414 | { 415 | "cell_type": "code", 416 | "execution_count": 22, 417 | "id": "0cdaf2fc", 418 | "metadata": {}, 419 | "outputs": [], 420 | "source": [ 421 | "s5 = frozenset(s)" 422 | ] 423 | }, 424 | { 425 | "cell_type": "code", 426 | "execution_count": 23, 427 | "id": "6a868f67", 428 | "metadata": {}, 429 | "outputs": [ 430 | { 431 | "data": { 432 | "text/plain": [ 433 | "frozenset({' ', 'a', 'c', 'd', 'e', 'i', 'n', 's', 't'})" 434 | ] 435 | }, 436 | "execution_count": 23, 437 | "metadata": {}, 438 | "output_type": "execute_result" 439 | } 440 | ], 441 | "source": [ 442 | "s5" 443 | ] 444 | }, 445 | { 446 | "cell_type": "code", 447 | "execution_count": 24, 448 | "id": "8c699682", 449 | "metadata": {}, 450 | "outputs": [ 451 | { 452 | "data": { 453 | "text/plain": [ 454 | "[['d'], ['a'], ['e'], [' '], ['i'], ['c'], ['t'], ['n'], ['s']]" 455 | ] 456 | }, 457 | "execution_count": 24, 458 | "metadata": {}, 459 | "output_type": "execute_result" 460 | } 461 | ], 462 | "source": [ 463 | "[list(x) for x in s5]" 464 | ] 465 | }, 466 | { 467 | "cell_type": "code", 468 | "execution_count": 25, 469 | "id": "f48191ed", 470 | "metadata": {}, 471 | "outputs": [ 472 | { 473 | "data": { 474 | "text/plain": [ 475 | "[('d',), ('a',), ('e',), (' ',), ('i',), ('c',), ('t',), ('n',), ('s',)]" 476 | ] 477 | }, 478 | "execution_count": 25, 479 | "metadata": {}, 480 | "output_type": "execute_result" 481 | } 482 | ], 483 | "source": [ 484 | "[tuple(x) for x in s5]" 485 | ] 486 | }, 487 | { 488 | "cell_type": "code", 489 | "execution_count": 26, 490 | "id": "6fd9e933", 491 | "metadata": {}, 492 | "outputs": [ 493 | { 494 | "data": { 495 | "text/plain": [ 496 | "[{'d'}, {'a'}, {'e'}, {' '}, {'i'}, {'c'}, {'t'}, {'n'}, {'s'}]" 497 | ] 498 | }, 499 | "execution_count": 26, 500 | "metadata": {}, 501 | "output_type": "execute_result" 502 | } 503 | ], 504 | "source": [ 505 | "[set(x) for x in s5]" 506 | ] 507 | }, 508 | { 509 | "cell_type": "code", 510 | "execution_count": null, 511 | "id": "cd5e18cd", 512 | "metadata": {}, 513 | "outputs": [], 514 | "source": [] 515 | } 516 | ], 517 | "metadata": { 518 | "kernelspec": { 519 | "display_name": "Python 3 (ipykernel)", 520 | "language": "python", 521 | "name": "python3" 522 | }, 523 | "language_info": { 524 | "codemirror_mode": { 525 | "name": "ipython", 526 | "version": 3 527 | }, 528 | "file_extension": ".py", 529 | "mimetype": "text/x-python", 530 | "name": "python", 531 | "nbconvert_exporter": "python", 532 | "pygments_lexer": "ipython3", 533 | "version": "3.9.13" 534 | } 535 | }, 536 | "nbformat": 4, 537 | "nbformat_minor": 5 538 | } 539 | -------------------------------------------------------------------------------- /Day 20 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "5b0e9aab", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "de71d7db", 17 | "metadata": {}, 18 | "source": [ 19 | "# Array in Python" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 1, 25 | "id": "8a57af45", 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "import array as ar" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 3, 35 | "id": "ba0671cd", 36 | "metadata": {}, 37 | "outputs": [], 38 | "source": [ 39 | "ar1 = ar.array('i',[1,2,3,5,10])" 40 | ] 41 | }, 42 | { 43 | "cell_type": "code", 44 | "execution_count": 4, 45 | "id": "40e47d95", 46 | "metadata": {}, 47 | "outputs": [ 48 | { 49 | "data": { 50 | "text/plain": [ 51 | "array('i', [1, 2, 3, 5, 10])" 52 | ] 53 | }, 54 | "execution_count": 4, 55 | "metadata": {}, 56 | "output_type": "execute_result" 57 | } 58 | ], 59 | "source": [ 60 | "ar1" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": 6, 66 | "id": "b99f7794", 67 | "metadata": {}, 68 | "outputs": [], 69 | "source": [ 70 | "ar1 = ar.array('f',[1,2,3,5,10.5])" 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": 7, 76 | "id": "958e5c08", 77 | "metadata": {}, 78 | "outputs": [ 79 | { 80 | "data": { 81 | "text/plain": [ 82 | "array('f', [1.0, 2.0, 3.0, 5.0, 10.5])" 83 | ] 84 | }, 85 | "execution_count": 7, 86 | "metadata": {}, 87 | "output_type": "execute_result" 88 | } 89 | ], 90 | "source": [ 91 | "ar1" 92 | ] 93 | }, 94 | { 95 | "cell_type": "code", 96 | "execution_count": 8, 97 | "id": "0c04daaa", 98 | "metadata": {}, 99 | "outputs": [ 100 | { 101 | "data": { 102 | "text/plain": [ 103 | "1.0" 104 | ] 105 | }, 106 | "execution_count": 8, 107 | "metadata": {}, 108 | "output_type": "execute_result" 109 | } 110 | ], 111 | "source": [ 112 | "ar1[0]" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 9, 118 | "id": "45a8022c", 119 | "metadata": {}, 120 | "outputs": [], 121 | "source": [ 122 | "ar1[0] = 15 # changeable" 123 | ] 124 | }, 125 | { 126 | "cell_type": "code", 127 | "execution_count": 10, 128 | "id": "2fa2ca5b", 129 | "metadata": {}, 130 | "outputs": [ 131 | { 132 | "data": { 133 | "text/plain": [ 134 | "array('f', [15.0, 2.0, 3.0, 5.0, 10.5])" 135 | ] 136 | }, 137 | "execution_count": 10, 138 | "metadata": {}, 139 | "output_type": "execute_result" 140 | } 141 | ], 142 | "source": [ 143 | "ar1" 144 | ] 145 | }, 146 | { 147 | "cell_type": "code", 148 | "execution_count": 12, 149 | "id": "b3703efd", 150 | "metadata": {}, 151 | "outputs": [ 152 | { 153 | "data": { 154 | "text/plain": [ 155 | "array('f', [3.0, 5.0])" 156 | ] 157 | }, 158 | "execution_count": 12, 159 | "metadata": {}, 160 | "output_type": "execute_result" 161 | } 162 | ], 163 | "source": [ 164 | "ar1[2:4]" 165 | ] 166 | }, 167 | { 168 | "cell_type": "code", 169 | "execution_count": 13, 170 | "id": "a76b1ac4", 171 | "metadata": {}, 172 | "outputs": [], 173 | "source": [ 174 | "ar1.append(8)" 175 | ] 176 | }, 177 | { 178 | "cell_type": "code", 179 | "execution_count": 14, 180 | "id": "1eb4bf1d", 181 | "metadata": {}, 182 | "outputs": [ 183 | { 184 | "data": { 185 | "text/plain": [ 186 | "array('f', [15.0, 2.0, 3.0, 5.0, 10.5, 8.0])" 187 | ] 188 | }, 189 | "execution_count": 14, 190 | "metadata": {}, 191 | "output_type": "execute_result" 192 | } 193 | ], 194 | "source": [ 195 | "ar1" 196 | ] 197 | }, 198 | { 199 | "cell_type": "code", 200 | "execution_count": 15, 201 | "id": "f5e79a30", 202 | "metadata": {}, 203 | "outputs": [], 204 | "source": [ 205 | "del ar1[-1]" 206 | ] 207 | }, 208 | { 209 | "cell_type": "code", 210 | "execution_count": 16, 211 | "id": "20d61e65", 212 | "metadata": {}, 213 | "outputs": [ 214 | { 215 | "data": { 216 | "text/plain": [ 217 | "array('f', [15.0, 2.0, 3.0, 5.0, 10.5])" 218 | ] 219 | }, 220 | "execution_count": 16, 221 | "metadata": {}, 222 | "output_type": "execute_result" 223 | } 224 | ], 225 | "source": [ 226 | "ar1" 227 | ] 228 | }, 229 | { 230 | "cell_type": "code", 231 | "execution_count": 17, 232 | "id": "fdc0f353", 233 | "metadata": {}, 234 | "outputs": [ 235 | { 236 | "data": { 237 | "text/plain": [ 238 | "5" 239 | ] 240 | }, 241 | "execution_count": 17, 242 | "metadata": {}, 243 | "output_type": "execute_result" 244 | } 245 | ], 246 | "source": [ 247 | "len(ar1)" 248 | ] 249 | }, 250 | { 251 | "cell_type": "code", 252 | "execution_count": 18, 253 | "id": "e150f42b", 254 | "metadata": {}, 255 | "outputs": [], 256 | "source": [ 257 | "ar1.reverse()" 258 | ] 259 | }, 260 | { 261 | "cell_type": "code", 262 | "execution_count": 19, 263 | "id": "0599ed4a", 264 | "metadata": {}, 265 | "outputs": [ 266 | { 267 | "data": { 268 | "text/plain": [ 269 | "array('f', [10.5, 5.0, 3.0, 2.0, 15.0])" 270 | ] 271 | }, 272 | "execution_count": 19, 273 | "metadata": {}, 274 | "output_type": "execute_result" 275 | } 276 | ], 277 | "source": [ 278 | "ar1" 279 | ] 280 | }, 281 | { 282 | "cell_type": "code", 283 | "execution_count": 27, 284 | "id": "ff461399", 285 | "metadata": {}, 286 | "outputs": [ 287 | { 288 | "data": { 289 | "text/plain": [ 290 | "1" 291 | ] 292 | }, 293 | "execution_count": 27, 294 | "metadata": {}, 295 | "output_type": "execute_result" 296 | } 297 | ], 298 | "source": [ 299 | "ar1.count(5)" 300 | ] 301 | }, 302 | { 303 | "cell_type": "code", 304 | "execution_count": 28, 305 | "id": "f1a30291", 306 | "metadata": {}, 307 | "outputs": [ 308 | { 309 | "data": { 310 | "text/plain": [ 311 | "0" 312 | ] 313 | }, 314 | "execution_count": 28, 315 | "metadata": {}, 316 | "output_type": "execute_result" 317 | } 318 | ], 319 | "source": [ 320 | "ar1.index(10.5)" 321 | ] 322 | }, 323 | { 324 | "cell_type": "code", 325 | "execution_count": 29, 326 | "id": "557ee0ce", 327 | "metadata": {}, 328 | "outputs": [ 329 | { 330 | "data": { 331 | "text/plain": [ 332 | "2.0" 333 | ] 334 | }, 335 | "execution_count": 29, 336 | "metadata": {}, 337 | "output_type": "execute_result" 338 | } 339 | ], 340 | "source": [ 341 | "ar1.pop(3) # 3 is index no" 342 | ] 343 | }, 344 | { 345 | "cell_type": "code", 346 | "execution_count": 30, 347 | "id": "c3dcbf7a", 348 | "metadata": {}, 349 | "outputs": [ 350 | { 351 | "data": { 352 | "text/plain": [ 353 | "array('f', [10.5, 5.0, 3.0, 15.0])" 354 | ] 355 | }, 356 | "execution_count": 30, 357 | "metadata": {}, 358 | "output_type": "execute_result" 359 | } 360 | ], 361 | "source": [ 362 | "ar1" 363 | ] 364 | }, 365 | { 366 | "cell_type": "code", 367 | "execution_count": 31, 368 | "id": "e8f6d94e", 369 | "metadata": {}, 370 | "outputs": [], 371 | "source": [ 372 | "ar1.remove(3)" 373 | ] 374 | }, 375 | { 376 | "cell_type": "code", 377 | "execution_count": 32, 378 | "id": "6595ed84", 379 | "metadata": {}, 380 | "outputs": [ 381 | { 382 | "data": { 383 | "text/plain": [ 384 | "array('f', [10.5, 5.0, 15.0])" 385 | ] 386 | }, 387 | "execution_count": 32, 388 | "metadata": {}, 389 | "output_type": "execute_result" 390 | } 391 | ], 392 | "source": [ 393 | "ar1" 394 | ] 395 | }, 396 | { 397 | "cell_type": "code", 398 | "execution_count": 33, 399 | "id": "6106865e", 400 | "metadata": {}, 401 | "outputs": [ 402 | { 403 | "name": "stdout", 404 | "output_type": "stream", 405 | "text": [ 406 | "5\n", 407 | "1\n", 408 | "1\n", 409 | "2\n", 410 | "2\n", 411 | "3\n", 412 | "3\n", 413 | "6\n", 414 | "6\n", 415 | "7\n", 416 | "7\n" 417 | ] 418 | } 419 | ], 420 | "source": [ 421 | "r = ar.array('i', [])\n", 422 | "\n", 423 | "items = int(input())\n", 424 | "for i in range(items):\n", 425 | " val = int(input())\n", 426 | " r.append(val)\n", 427 | " print(val)" 428 | ] 429 | }, 430 | { 431 | "cell_type": "code", 432 | "execution_count": 34, 433 | "id": "0a3022b9", 434 | "metadata": {}, 435 | "outputs": [ 436 | { 437 | "data": { 438 | "text/plain": [ 439 | "array('i', [1, 2, 3, 6, 7])" 440 | ] 441 | }, 442 | "execution_count": 34, 443 | "metadata": {}, 444 | "output_type": "execute_result" 445 | } 446 | ], 447 | "source": [ 448 | "r" 449 | ] 450 | }, 451 | { 452 | "cell_type": "code", 453 | "execution_count": 35, 454 | "id": "551a2665", 455 | "metadata": {}, 456 | "outputs": [ 457 | { 458 | "name": "stdout", 459 | "output_type": "stream", 460 | "text": [ 461 | "3\n", 462 | "12\n", 463 | "15\n", 464 | "20\n", 465 | "array('i', [12, 15, 20])\n" 466 | ] 467 | } 468 | ], 469 | "source": [ 470 | "r = ar.array('i', [])\n", 471 | "\n", 472 | "items = int(input())\n", 473 | "for i in range(items):\n", 474 | " val = int(input())\n", 475 | " r.append(val)\n", 476 | "print(r)" 477 | ] 478 | }, 479 | { 480 | "cell_type": "code", 481 | "execution_count": null, 482 | "id": "4a747319", 483 | "metadata": {}, 484 | "outputs": [], 485 | "source": [] 486 | } 487 | ], 488 | "metadata": { 489 | "kernelspec": { 490 | "display_name": "Python 3 (ipykernel)", 491 | "language": "python", 492 | "name": "python3" 493 | }, 494 | "language_info": { 495 | "codemirror_mode": { 496 | "name": "ipython", 497 | "version": 3 498 | }, 499 | "file_extension": ".py", 500 | "mimetype": "text/x-python", 501 | "name": "python", 502 | "nbconvert_exporter": "python", 503 | "pygments_lexer": "ipython3", 504 | "version": "3.9.13" 505 | } 506 | }, 507 | "nbformat": 4, 508 | "nbformat_minor": 5 509 | } 510 | -------------------------------------------------------------------------------- /Day 21 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "70eb7a62", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "3e79c503", 17 | "metadata": {}, 18 | "source": [ 19 | "# Dictionaries" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 1, 25 | "id": "fac980b1", 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "dic = {\n", 30 | " 'name':'shakil' ,\n", 31 | " 'varisty': 'DIU',\n", 32 | "}" 33 | ] 34 | }, 35 | { 36 | "cell_type": "code", 37 | "execution_count": 2, 38 | "id": "5787eb08", 39 | "metadata": {}, 40 | "outputs": [ 41 | { 42 | "data": { 43 | "text/plain": [ 44 | "{'name': 'shakil', 'varisty': 'DIU'}" 45 | ] 46 | }, 47 | "execution_count": 2, 48 | "metadata": {}, 49 | "output_type": "execute_result" 50 | } 51 | ], 52 | "source": [ 53 | "dic" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": 3, 59 | "id": "f459aa7d", 60 | "metadata": {}, 61 | "outputs": [ 62 | { 63 | "data": { 64 | "text/plain": [ 65 | "dict_keys(['name', 'varisty'])" 66 | ] 67 | }, 68 | "execution_count": 3, 69 | "metadata": {}, 70 | "output_type": "execute_result" 71 | } 72 | ], 73 | "source": [ 74 | "dic.keys()" 75 | ] 76 | }, 77 | { 78 | "cell_type": "code", 79 | "execution_count": 4, 80 | "id": "399556f7", 81 | "metadata": {}, 82 | "outputs": [ 83 | { 84 | "data": { 85 | "text/plain": [ 86 | "dict" 87 | ] 88 | }, 89 | "execution_count": 4, 90 | "metadata": {}, 91 | "output_type": "execute_result" 92 | } 93 | ], 94 | "source": [ 95 | "type(dic)" 96 | ] 97 | }, 98 | { 99 | "cell_type": "code", 100 | "execution_count": 5, 101 | "id": "a1aa695c", 102 | "metadata": {}, 103 | "outputs": [ 104 | { 105 | "data": { 106 | "text/plain": [ 107 | "dict_values(['shakil', 'DIU'])" 108 | ] 109 | }, 110 | "execution_count": 5, 111 | "metadata": {}, 112 | "output_type": "execute_result" 113 | } 114 | ], 115 | "source": [ 116 | "dic.values()" 117 | ] 118 | }, 119 | { 120 | "cell_type": "code", 121 | "execution_count": 6, 122 | "id": "e3eeda7e", 123 | "metadata": {}, 124 | "outputs": [], 125 | "source": [ 126 | "#copy\n", 127 | "dic2 = dic.copy()" 128 | ] 129 | }, 130 | { 131 | "cell_type": "code", 132 | "execution_count": 7, 133 | "id": "e0a63cad", 134 | "metadata": {}, 135 | "outputs": [ 136 | { 137 | "data": { 138 | "text/plain": [ 139 | "{'name': 'shakil', 'varisty': 'DIU'}" 140 | ] 141 | }, 142 | "execution_count": 7, 143 | "metadata": {}, 144 | "output_type": "execute_result" 145 | } 146 | ], 147 | "source": [ 148 | "dic2" 149 | ] 150 | }, 151 | { 152 | "cell_type": "code", 153 | "execution_count": 10, 154 | "id": "1bd4e9ce", 155 | "metadata": {}, 156 | "outputs": [], 157 | "source": [ 158 | "dic['varisty'] = 'FAU'" 159 | ] 160 | }, 161 | { 162 | "cell_type": "code", 163 | "execution_count": 11, 164 | "id": "be67f301", 165 | "metadata": {}, 166 | "outputs": [ 167 | { 168 | "data": { 169 | "text/plain": [ 170 | "{'name': 'shakil', 'varisty': 'FAU'}" 171 | ] 172 | }, 173 | "execution_count": 11, 174 | "metadata": {}, 175 | "output_type": "execute_result" 176 | } 177 | ], 178 | "source": [ 179 | "dic" 180 | ] 181 | }, 182 | { 183 | "cell_type": "code", 184 | "execution_count": 14, 185 | "id": "e495fe23", 186 | "metadata": {}, 187 | "outputs": [], 188 | "source": [ 189 | "dic['dept'] = 'Data Science'" 190 | ] 191 | }, 192 | { 193 | "cell_type": "code", 194 | "execution_count": 15, 195 | "id": "7f15fc66", 196 | "metadata": {}, 197 | "outputs": [ 198 | { 199 | "data": { 200 | "text/plain": [ 201 | "{'name': 'shakil', 'varisty': 'FAU', 'dept': 'Data Science'}" 202 | ] 203 | }, 204 | "execution_count": 15, 205 | "metadata": {}, 206 | "output_type": "execute_result" 207 | } 208 | ], 209 | "source": [ 210 | "dic" 211 | ] 212 | }, 213 | { 214 | "cell_type": "code", 215 | "execution_count": 16, 216 | "id": "d87abeeb", 217 | "metadata": {}, 218 | "outputs": [], 219 | "source": [ 220 | "dic.update({'dept':'ai'})" 221 | ] 222 | }, 223 | { 224 | "cell_type": "code", 225 | "execution_count": 17, 226 | "id": "6f2cf686", 227 | "metadata": {}, 228 | "outputs": [ 229 | { 230 | "data": { 231 | "text/plain": [ 232 | "{'name': 'shakil', 'varisty': 'FAU', 'dept': 'ai'}" 233 | ] 234 | }, 235 | "execution_count": 17, 236 | "metadata": {}, 237 | "output_type": "execute_result" 238 | } 239 | ], 240 | "source": [ 241 | "dic" 242 | ] 243 | }, 244 | { 245 | "cell_type": "code", 246 | "execution_count": 18, 247 | "id": "49d8b494", 248 | "metadata": {}, 249 | "outputs": [ 250 | { 251 | "data": { 252 | "text/plain": [ 253 | "('dept', 'ai')" 254 | ] 255 | }, 256 | "execution_count": 18, 257 | "metadata": {}, 258 | "output_type": "execute_result" 259 | } 260 | ], 261 | "source": [ 262 | "dic.popitem()" 263 | ] 264 | }, 265 | { 266 | "cell_type": "code", 267 | "execution_count": 19, 268 | "id": "af69630a", 269 | "metadata": {}, 270 | "outputs": [ 271 | { 272 | "data": { 273 | "text/plain": [ 274 | "{'name': 'shakil', 'varisty': 'FAU'}" 275 | ] 276 | }, 277 | "execution_count": 19, 278 | "metadata": {}, 279 | "output_type": "execute_result" 280 | } 281 | ], 282 | "source": [ 283 | "dic" 284 | ] 285 | }, 286 | { 287 | "cell_type": "code", 288 | "execution_count": 21, 289 | "id": "60a1a335", 290 | "metadata": {}, 291 | "outputs": [ 292 | { 293 | "data": { 294 | "text/plain": [ 295 | "'FAU'" 296 | ] 297 | }, 298 | "execution_count": 21, 299 | "metadata": {}, 300 | "output_type": "execute_result" 301 | } 302 | ], 303 | "source": [ 304 | "dic.pop('varisty')" 305 | ] 306 | }, 307 | { 308 | "cell_type": "code", 309 | "execution_count": 23, 310 | "id": "64801dd7", 311 | "metadata": {}, 312 | "outputs": [ 313 | { 314 | "data": { 315 | "text/plain": [ 316 | "{'name': 'shakil'}" 317 | ] 318 | }, 319 | "execution_count": 23, 320 | "metadata": {}, 321 | "output_type": "execute_result" 322 | } 323 | ], 324 | "source": [ 325 | "dic" 326 | ] 327 | }, 328 | { 329 | "cell_type": "code", 330 | "execution_count": 24, 331 | "id": "89716edc", 332 | "metadata": {}, 333 | "outputs": [], 334 | "source": [ 335 | "dic['dept'] = 'Data Science'" 336 | ] 337 | }, 338 | { 339 | "cell_type": "code", 340 | "execution_count": 25, 341 | "id": "03e230cd", 342 | "metadata": {}, 343 | "outputs": [ 344 | { 345 | "data": { 346 | "text/plain": [ 347 | "{'name': 'shakil', 'dept': 'Data Science'}" 348 | ] 349 | }, 350 | "execution_count": 25, 351 | "metadata": {}, 352 | "output_type": "execute_result" 353 | } 354 | ], 355 | "source": [ 356 | "dic" 357 | ] 358 | }, 359 | { 360 | "cell_type": "code", 361 | "execution_count": 26, 362 | "id": "0bfbbb08", 363 | "metadata": {}, 364 | "outputs": [], 365 | "source": [ 366 | "del dic['name']" 367 | ] 368 | }, 369 | { 370 | "cell_type": "code", 371 | "execution_count": 27, 372 | "id": "bcfa4c83", 373 | "metadata": {}, 374 | "outputs": [ 375 | { 376 | "data": { 377 | "text/plain": [ 378 | "{'dept': 'Data Science'}" 379 | ] 380 | }, 381 | "execution_count": 27, 382 | "metadata": {}, 383 | "output_type": "execute_result" 384 | } 385 | ], 386 | "source": [ 387 | "dic" 388 | ] 389 | }, 390 | { 391 | "cell_type": "code", 392 | "execution_count": 28, 393 | "id": "997173ac", 394 | "metadata": {}, 395 | "outputs": [], 396 | "source": [ 397 | "dic['dept2'] = 'ai'" 398 | ] 399 | }, 400 | { 401 | "cell_type": "code", 402 | "execution_count": 29, 403 | "id": "6ad16d1c", 404 | "metadata": {}, 405 | "outputs": [ 406 | { 407 | "data": { 408 | "text/plain": [ 409 | "{'dept': 'Data Science', 'dept2': 'ai'}" 410 | ] 411 | }, 412 | "execution_count": 29, 413 | "metadata": {}, 414 | "output_type": "execute_result" 415 | } 416 | ], 417 | "source": [ 418 | "dic" 419 | ] 420 | }, 421 | { 422 | "cell_type": "code", 423 | "execution_count": 30, 424 | "id": "e2ec5fd6", 425 | "metadata": {}, 426 | "outputs": [ 427 | { 428 | "name": "stdout", 429 | "output_type": "stream", 430 | "text": [ 431 | "Data Science\n", 432 | "ai\n" 433 | ] 434 | } 435 | ], 436 | "source": [ 437 | "#print all items\n", 438 | "for x in dic:\n", 439 | " print(dic[x])" 440 | ] 441 | }, 442 | { 443 | "cell_type": "code", 444 | "execution_count": 31, 445 | "id": "c67c5225", 446 | "metadata": {}, 447 | "outputs": [ 448 | { 449 | "name": "stdout", 450 | "output_type": "stream", 451 | "text": [ 452 | "dept\n", 453 | "dept2\n" 454 | ] 455 | } 456 | ], 457 | "source": [ 458 | "for x in dic:\n", 459 | " print(x)" 460 | ] 461 | }, 462 | { 463 | "cell_type": "code", 464 | "execution_count": 32, 465 | "id": "666be943", 466 | "metadata": {}, 467 | "outputs": [], 468 | "source": [ 469 | "d2 = list(dic.keys())" 470 | ] 471 | }, 472 | { 473 | "cell_type": "code", 474 | "execution_count": 33, 475 | "id": "5cb318c1", 476 | "metadata": {}, 477 | "outputs": [ 478 | { 479 | "data": { 480 | "text/plain": [ 481 | "['dept', 'dept2']" 482 | ] 483 | }, 484 | "execution_count": 33, 485 | "metadata": {}, 486 | "output_type": "execute_result" 487 | } 488 | ], 489 | "source": [ 490 | "d2" 491 | ] 492 | }, 493 | { 494 | "cell_type": "code", 495 | "execution_count": 34, 496 | "id": "c6d3c3a1", 497 | "metadata": {}, 498 | "outputs": [], 499 | "source": [ 500 | "d3 = list(dic.values())" 501 | ] 502 | }, 503 | { 504 | "cell_type": "code", 505 | "execution_count": 35, 506 | "id": "7d108025", 507 | "metadata": {}, 508 | "outputs": [ 509 | { 510 | "data": { 511 | "text/plain": [ 512 | "['Data Science', 'ai']" 513 | ] 514 | }, 515 | "execution_count": 35, 516 | "metadata": {}, 517 | "output_type": "execute_result" 518 | } 519 | ], 520 | "source": [ 521 | "d3" 522 | ] 523 | }, 524 | { 525 | "cell_type": "code", 526 | "execution_count": 36, 527 | "id": "97b49f4d", 528 | "metadata": {}, 529 | "outputs": [ 530 | { 531 | "name": "stdout", 532 | "output_type": "stream", 533 | "text": [ 534 | "3\n", 535 | "name\n", 536 | "shakil\n", 537 | "dept\n", 538 | "data science\n", 539 | "dept2\n", 540 | "NLP\n", 541 | "{'name': 'shakil', 'dept': 'data science', 'dept2': 'NLP'}\n" 542 | ] 543 | } 544 | ], 545 | "source": [ 546 | "#dic from user input\n", 547 | "n = int(input())\n", 548 | "d = {}\n", 549 | "\n", 550 | "for i in range(n):\n", 551 | " key = input()\n", 552 | " value = input()\n", 553 | " d[key]=value\n", 554 | " \n", 555 | "print(d)\n" 556 | ] 557 | }, 558 | { 559 | "cell_type": "code", 560 | "execution_count": 38, 561 | "id": "e558d4d8", 562 | "metadata": {}, 563 | "outputs": [ 564 | { 565 | "data": { 566 | "text/plain": [ 567 | "{'name': 'shakil', 'dept': 'data science', 'dept2': 'NLP'}" 568 | ] 569 | }, 570 | "execution_count": 38, 571 | "metadata": {}, 572 | "output_type": "execute_result" 573 | } 574 | ], 575 | "source": [ 576 | "d" 577 | ] 578 | }, 579 | { 580 | "cell_type": "code", 581 | "execution_count": null, 582 | "id": "11745f8f", 583 | "metadata": {}, 584 | "outputs": [], 585 | "source": [] 586 | } 587 | ], 588 | "metadata": { 589 | "kernelspec": { 590 | "display_name": "Python 3 (ipykernel)", 591 | "language": "python", 592 | "name": "python3" 593 | }, 594 | "language_info": { 595 | "codemirror_mode": { 596 | "name": "ipython", 597 | "version": 3 598 | }, 599 | "file_extension": ".py", 600 | "mimetype": "text/x-python", 601 | "name": "python", 602 | "nbconvert_exporter": "python", 603 | "pygments_lexer": "ipython3", 604 | "version": "3.9.13" 605 | } 606 | }, 607 | "nbformat": 4, 608 | "nbformat_minor": 5 609 | } 610 | -------------------------------------------------------------------------------- /Day 22 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "ae2f30c4", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 1, 17 | "id": "52515b65", 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "name = ['shakil', 'mejbah', 'sohan']\n", 22 | "varsity = ['diu', 'aiub','diu']" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": 2, 28 | "id": "e8f49585", 29 | "metadata": {}, 30 | "outputs": [ 31 | { 32 | "name": "stdout", 33 | "output_type": "stream", 34 | "text": [ 35 | "\n" 36 | ] 37 | } 38 | ], 39 | "source": [ 40 | "# ('shakil', 'diu'), ('mejbah,'aiub',..........)\n", 41 | "zipped = zip(name, varsity)\n", 42 | "print(zipped)" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 3, 48 | "id": "e5de0fa6", 49 | "metadata": {}, 50 | "outputs": [ 51 | { 52 | "name": "stdout", 53 | "output_type": "stream", 54 | "text": [ 55 | "[('shakil', 'diu'), ('mejbah', 'aiub'), ('sohan', 'diu')]\n" 56 | ] 57 | } 58 | ], 59 | "source": [ 60 | "zipped = list(zip(name, varsity))\n", 61 | "print(zipped)" 62 | ] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": 4, 67 | "id": "c65935d7", 68 | "metadata": {}, 69 | "outputs": [ 70 | { 71 | "name": "stdout", 72 | "output_type": "stream", 73 | "text": [ 74 | "(('shakil', 'diu'), ('mejbah', 'aiub'), ('sohan', 'diu'))\n" 75 | ] 76 | } 77 | ], 78 | "source": [ 79 | "zipped = tuple(zip(name, varsity))\n", 80 | "print(zipped)" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": 5, 86 | "id": "1a6ce917", 87 | "metadata": {}, 88 | "outputs": [ 89 | { 90 | "name": "stdout", 91 | "output_type": "stream", 92 | "text": [ 93 | "{'shakil': 'diu', 'mejbah': 'aiub', 'sohan': 'diu'}\n" 94 | ] 95 | } 96 | ], 97 | "source": [ 98 | "zipped = dict(zip(name, varsity))\n", 99 | "print(zipped)" 100 | ] 101 | }, 102 | { 103 | "cell_type": "code", 104 | "execution_count": 6, 105 | "id": "c7a006e1", 106 | "metadata": {}, 107 | "outputs": [ 108 | { 109 | "data": { 110 | "text/plain": [ 111 | "dict_keys(['shakil', 'mejbah', 'sohan'])" 112 | ] 113 | }, 114 | "execution_count": 6, 115 | "metadata": {}, 116 | "output_type": "execute_result" 117 | } 118 | ], 119 | "source": [ 120 | "zipped.keys()" 121 | ] 122 | }, 123 | { 124 | "cell_type": "code", 125 | "execution_count": 7, 126 | "id": "0e416325", 127 | "metadata": {}, 128 | "outputs": [ 129 | { 130 | "data": { 131 | "text/plain": [ 132 | "dict_values(['diu', 'aiub', 'diu'])" 133 | ] 134 | }, 135 | "execution_count": 7, 136 | "metadata": {}, 137 | "output_type": "execute_result" 138 | } 139 | ], 140 | "source": [ 141 | "zipped.values()" 142 | ] 143 | }, 144 | { 145 | "cell_type": "code", 146 | "execution_count": 8, 147 | "id": "0e4449d5", 148 | "metadata": {}, 149 | "outputs": [ 150 | { 151 | "name": "stdout", 152 | "output_type": "stream", 153 | "text": [ 154 | "{('mejbah', 'aiub'), ('sohan', 'diu'), ('shakil', 'diu')}\n" 155 | ] 156 | } 157 | ], 158 | "source": [ 159 | "zipped = set(zip(name, varsity))\n", 160 | "print(zipped)" 161 | ] 162 | }, 163 | { 164 | "cell_type": "markdown", 165 | "id": "b5978891", 166 | "metadata": {}, 167 | "source": [ 168 | "# Unzip" 169 | ] 170 | }, 171 | { 172 | "cell_type": "code", 173 | "execution_count": 9, 174 | "id": "e5eb4740", 175 | "metadata": {}, 176 | "outputs": [ 177 | { 178 | "name": "stdout", 179 | "output_type": "stream", 180 | "text": [ 181 | "[('shakil', 'diu'), ('mejbah', 'aiub'), ('sohan', 'diu')]\n" 182 | ] 183 | } 184 | ], 185 | "source": [ 186 | "zipped = list(zip(name, varsity))\n", 187 | "print(zipped)" 188 | ] 189 | }, 190 | { 191 | "cell_type": "code", 192 | "execution_count": 10, 193 | "id": "cc5633fb", 194 | "metadata": {}, 195 | "outputs": [], 196 | "source": [ 197 | "name1, varsity1 = zip(*zipped)" 198 | ] 199 | }, 200 | { 201 | "cell_type": "code", 202 | "execution_count": 11, 203 | "id": "edd243bb", 204 | "metadata": {}, 205 | "outputs": [ 206 | { 207 | "data": { 208 | "text/plain": [ 209 | "('shakil', 'mejbah', 'sohan')" 210 | ] 211 | }, 212 | "execution_count": 11, 213 | "metadata": {}, 214 | "output_type": "execute_result" 215 | } 216 | ], 217 | "source": [ 218 | "name1" 219 | ] 220 | }, 221 | { 222 | "cell_type": "code", 223 | "execution_count": 12, 224 | "id": "4d121f15", 225 | "metadata": {}, 226 | "outputs": [ 227 | { 228 | "data": { 229 | "text/plain": [ 230 | "('diu', 'aiub', 'diu')" 231 | ] 232 | }, 233 | "execution_count": 12, 234 | "metadata": {}, 235 | "output_type": "execute_result" 236 | } 237 | ], 238 | "source": [ 239 | "varsity1" 240 | ] 241 | }, 242 | { 243 | "cell_type": "code", 244 | "execution_count": null, 245 | "id": "768d69c3", 246 | "metadata": {}, 247 | "outputs": [], 248 | "source": [] 249 | } 250 | ], 251 | "metadata": { 252 | "kernelspec": { 253 | "display_name": "Python 3 (ipykernel)", 254 | "language": "python", 255 | "name": "python3" 256 | }, 257 | "language_info": { 258 | "codemirror_mode": { 259 | "name": "ipython", 260 | "version": 3 261 | }, 262 | "file_extension": ".py", 263 | "mimetype": "text/x-python", 264 | "name": "python", 265 | "nbconvert_exporter": "python", 266 | "pygments_lexer": "ipython3", 267 | "version": "3.9.13" 268 | } 269 | }, 270 | "nbformat": 4, 271 | "nbformat_minor": 5 272 | } 273 | -------------------------------------------------------------------------------- /Day 23 - 60 days of python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "c3321b5b", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 3, 17 | "id": "ab502616", 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "import zipfile as zp\n", 22 | "\n", 23 | "zipp = zp.ZipFile('Zipped.zip','w') # w stands for write\n", 24 | "\n", 25 | "zipp.write('assignment1.png')\n", 26 | "zipp.write('dsa.jpg')\n", 27 | "zipp.write('LOR Visa.docx')" 28 | ] 29 | }, 30 | { 31 | "cell_type": "markdown", 32 | "id": "83e76d45", 33 | "metadata": {}, 34 | "source": [ 35 | "# unzip" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": 6, 41 | "id": "c67a5d16", 42 | "metadata": {}, 43 | "outputs": [], 44 | "source": [ 45 | "with zp.ZipFile('Zipped.zip','r') as file: # r stands for read\n", 46 | " file.extractall('TEMP Unzip')\n" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": null, 52 | "id": "a240132c", 53 | "metadata": {}, 54 | "outputs": [], 55 | "source": [] 56 | } 57 | ], 58 | "metadata": { 59 | "kernelspec": { 60 | "display_name": "Python 3 (ipykernel)", 61 | "language": "python", 62 | "name": "python3" 63 | }, 64 | "language_info": { 65 | "codemirror_mode": { 66 | "name": "ipython", 67 | "version": 3 68 | }, 69 | "file_extension": ".py", 70 | "mimetype": "text/x-python", 71 | "name": "python", 72 | "nbconvert_exporter": "python", 73 | "pygments_lexer": "ipython3", 74 | "version": "3.9.13" 75 | } 76 | }, 77 | "nbformat": 4, 78 | "nbformat_minor": 5 79 | } 80 | -------------------------------------------------------------------------------- /Day 24 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "d65136cd", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 1, 17 | "id": "e6384597", 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "main = 'You have got to be selected by a Barcelona scout'\n", 22 | "\n", 23 | "search_word = 'Barcelona'\n", 24 | "replace_word = \"Bayern Munich\"\n", 25 | "\n", 26 | "with open(r'text1.txt', 'r') as file:\n", 27 | " data = file.read()\n", 28 | " data = data.replace(search_word, replace_word)\n" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 2, 34 | "id": "e2e998a5", 35 | "metadata": {}, 36 | "outputs": [], 37 | "source": [ 38 | "with open(r'text1.txt', 'w') as file:\n", 39 | " file.write(data)" 40 | ] 41 | }, 42 | { 43 | "cell_type": "code", 44 | "execution_count": 3, 45 | "id": "843034fe", 46 | "metadata": {}, 47 | "outputs": [], 48 | "source": [ 49 | "import re" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": 4, 55 | "id": "01a008f3", 56 | "metadata": {}, 57 | "outputs": [ 58 | { 59 | "data": { 60 | "text/plain": [ 61 | "'You have got to be selected by a Bayern Munich scout'" 62 | ] 63 | }, 64 | "execution_count": 4, 65 | "metadata": {}, 66 | "output_type": "execute_result" 67 | } 68 | ], 69 | "source": [ 70 | "re.sub(search_word , replace_word, main )" 71 | ] 72 | }, 73 | { 74 | "cell_type": "markdown", 75 | "id": "ba9479cb", 76 | "metadata": {}, 77 | "source": [ 78 | "Our Paid Courses on Data Science: https://allmylinks.com/studymart-paid-courses" 79 | ] 80 | }, 81 | { 82 | "cell_type": "code", 83 | "execution_count": null, 84 | "id": "beb32ea6", 85 | "metadata": {}, 86 | "outputs": [], 87 | "source": [] 88 | } 89 | ], 90 | "metadata": { 91 | "kernelspec": { 92 | "display_name": "Python 3 (ipykernel)", 93 | "language": "python", 94 | "name": "python3" 95 | }, 96 | "language_info": { 97 | "codemirror_mode": { 98 | "name": "ipython", 99 | "version": 3 100 | }, 101 | "file_extension": ".py", 102 | "mimetype": "text/x-python", 103 | "name": "python", 104 | "nbconvert_exporter": "python", 105 | "pygments_lexer": "ipython3", 106 | "version": "3.9.13" 107 | } 108 | }, 109 | "nbformat": 4, 110 | "nbformat_minor": 5 111 | } 112 | -------------------------------------------------------------------------------- /Day 25 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "f9011963", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "18eb8f35", 17 | "metadata": {}, 18 | "source": [ 19 | "# Unpacking Elements" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 1, 25 | "id": "63f35819", 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "ids = (1,2,3)\n", 30 | "name = ('shakil','mejbah','sohan')" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": 2, 36 | "id": "51409ff1", 37 | "metadata": {}, 38 | "outputs": [ 39 | { 40 | "data": { 41 | "text/plain": [ 42 | "((1, 'shakil'), (2, 'mejbah'), (3, 'sohan'))" 43 | ] 44 | }, 45 | "execution_count": 2, 46 | "metadata": {}, 47 | "output_type": "execute_result" 48 | } 49 | ], 50 | "source": [ 51 | "zipped = tuple(zip(ids, name))\n", 52 | "zipped" 53 | ] 54 | }, 55 | { 56 | "cell_type": "code", 57 | "execution_count": 3, 58 | "id": "031f3fa4", 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [ 62 | "ids_new, name_new = zip(*zipped)" 63 | ] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": 4, 68 | "id": "56e31d2b", 69 | "metadata": {}, 70 | "outputs": [ 71 | { 72 | "data": { 73 | "text/plain": [ 74 | "(1, 2, 3)" 75 | ] 76 | }, 77 | "execution_count": 4, 78 | "metadata": {}, 79 | "output_type": "execute_result" 80 | } 81 | ], 82 | "source": [ 83 | "ids_new" 84 | ] 85 | }, 86 | { 87 | "cell_type": "code", 88 | "execution_count": 5, 89 | "id": "cab75753", 90 | "metadata": {}, 91 | "outputs": [ 92 | { 93 | "data": { 94 | "text/plain": [ 95 | "('shakil', 'mejbah', 'sohan')" 96 | ] 97 | }, 98 | "execution_count": 5, 99 | "metadata": {}, 100 | "output_type": "execute_result" 101 | } 102 | ], 103 | "source": [ 104 | "name_new" 105 | ] 106 | }, 107 | { 108 | "cell_type": "code", 109 | "execution_count": 6, 110 | "id": "0013b664", 111 | "metadata": {}, 112 | "outputs": [ 113 | { 114 | "data": { 115 | "text/plain": [ 116 | "1" 117 | ] 118 | }, 119 | "execution_count": 6, 120 | "metadata": {}, 121 | "output_type": "execute_result" 122 | } 123 | ], 124 | "source": [ 125 | "i1, n1 = zipped[0]\n", 126 | "i1" 127 | ] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": 7, 132 | "id": "d763ae6d", 133 | "metadata": {}, 134 | "outputs": [ 135 | { 136 | "data": { 137 | "text/plain": [ 138 | "'shakil'" 139 | ] 140 | }, 141 | "execution_count": 7, 142 | "metadata": {}, 143 | "output_type": "execute_result" 144 | } 145 | ], 146 | "source": [ 147 | "n1" 148 | ] 149 | }, 150 | { 151 | "cell_type": "code", 152 | "execution_count": 8, 153 | "id": "6fe91279", 154 | "metadata": {}, 155 | "outputs": [ 156 | { 157 | "data": { 158 | "text/plain": [ 159 | "((1, 'shakil'), (2, 'mejbah'), (3, 'sohan'))" 160 | ] 161 | }, 162 | "execution_count": 8, 163 | "metadata": {}, 164 | "output_type": "execute_result" 165 | } 166 | ], 167 | "source": [ 168 | "zipped" 169 | ] 170 | }, 171 | { 172 | "cell_type": "code", 173 | "execution_count": 9, 174 | "id": "d8912e9f", 175 | "metadata": {}, 176 | "outputs": [ 177 | { 178 | "name": "stdout", 179 | "output_type": "stream", 180 | "text": [ 181 | "1 shakil\n", 182 | "2 mejbah\n", 183 | "3 sohan\n" 184 | ] 185 | } 186 | ], 187 | "source": [ 188 | "#Unpacking using loop\n", 189 | "for ids, names in zipped:\n", 190 | " print(ids, names)" 191 | ] 192 | }, 193 | { 194 | "cell_type": "code", 195 | "execution_count": 10, 196 | "id": "0657dbff", 197 | "metadata": {}, 198 | "outputs": [ 199 | { 200 | "name": "stdout", 201 | "output_type": "stream", 202 | "text": [ 203 | "(0, (1, 'shakil'))\n", 204 | "(1, (2, 'mejbah'))\n", 205 | "(2, (3, 'sohan'))\n" 206 | ] 207 | } 208 | ], 209 | "source": [ 210 | "#Enumerating: Iterate over pairs\n", 211 | "for data in enumerate(zipped):\n", 212 | " # Unpack pair: ids, name\n", 213 | " ids, name = data\n", 214 | " print(data)" 215 | ] 216 | }, 217 | { 218 | "cell_type": "code", 219 | "execution_count": 13, 220 | "id": "2c7db1de", 221 | "metadata": {}, 222 | "outputs": [ 223 | { 224 | "name": "stdout", 225 | "output_type": "stream", 226 | "text": [ 227 | "Rank 0, id= 1, Name= shakil\n", 228 | "Rank 1, id= 2, Name= mejbah\n", 229 | "Rank 2, id= 3, Name= sohan\n" 230 | ] 231 | } 232 | ], 233 | "source": [ 234 | "#Enumerating: Iterate over pairs\n", 235 | "for index, pair in enumerate(zipped):\n", 236 | " # Unpack pair: ids, name\n", 237 | " ids, name = pair\n", 238 | " print('Rank {}, id= {}, Name= {}'.format(index,ids, name))" 239 | ] 240 | }, 241 | { 242 | "cell_type": "code", 243 | "execution_count": null, 244 | "id": "cfb1c054", 245 | "metadata": {}, 246 | "outputs": [], 247 | "source": [] 248 | } 249 | ], 250 | "metadata": { 251 | "kernelspec": { 252 | "display_name": "Python 3 (ipykernel)", 253 | "language": "python", 254 | "name": "python3" 255 | }, 256 | "language_info": { 257 | "codemirror_mode": { 258 | "name": "ipython", 259 | "version": 3 260 | }, 261 | "file_extension": ".py", 262 | "mimetype": "text/x-python", 263 | "name": "python", 264 | "nbconvert_exporter": "python", 265 | "pygments_lexer": "ipython3", 266 | "version": "3.9.13" 267 | } 268 | }, 269 | "nbformat": 4, 270 | "nbformat_minor": 5 271 | } 272 | -------------------------------------------------------------------------------- /Day 26 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "041f5e70", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "b8154138", 17 | "metadata": {}, 18 | "source": [ 19 | "# Python Break Statement" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 1, 25 | "id": "1b6840a8", 26 | "metadata": {}, 27 | "outputs": [ 28 | { 29 | "name": "stdout", 30 | "output_type": "stream", 31 | "text": [ 32 | "1\n", 33 | "2\n", 34 | "3\n", 35 | "4\n", 36 | "5\n", 37 | "6\n", 38 | "7\n", 39 | "8\n", 40 | "9\n", 41 | "10\n" 42 | ] 43 | } 44 | ], 45 | "source": [ 46 | "for i in range(1,100):\n", 47 | " if i == 11:\n", 48 | " break\n", 49 | " print(i)" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": 2, 55 | "id": "d9c906f1", 56 | "metadata": {}, 57 | "outputs": [ 58 | { 59 | "name": "stdout", 60 | "output_type": "stream", 61 | "text": [ 62 | "3 * 1 = 3\n", 63 | "3 * 2 = 6\n", 64 | "3 * 3 = 9\n", 65 | "3 * 4 = 12\n", 66 | "3 * 5 = 15\n", 67 | "3 * 6 = 18\n", 68 | "3 * 7 = 21\n", 69 | "3 * 8 = 24\n", 70 | "3 * 9 = 27\n", 71 | "3 * 10 = 30\n" 72 | ] 73 | } 74 | ], 75 | "source": [ 76 | "for i in range(1,100):\n", 77 | " if i == 11:\n", 78 | " break\n", 79 | " print('3 *',i,'= ',i*3)" 80 | ] 81 | }, 82 | { 83 | "cell_type": "code", 84 | "execution_count": 3, 85 | "id": "a29e3794", 86 | "metadata": {}, 87 | "outputs": [], 88 | "source": [ 89 | "sen = 'I love Bangladesh and Germany'" 90 | ] 91 | }, 92 | { 93 | "cell_type": "code", 94 | "execution_count": 4, 95 | "id": "d636c7ff", 96 | "metadata": {}, 97 | "outputs": [ 98 | { 99 | "name": "stdout", 100 | "output_type": "stream", 101 | "text": [ 102 | "I\n", 103 | "love\n", 104 | "Bangladesh\n" 105 | ] 106 | } 107 | ], 108 | "source": [ 109 | "for i in sen.split():\n", 110 | " if i=='and':\n", 111 | " break\n", 112 | " print(i)" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 5, 118 | "id": "a4dd8003", 119 | "metadata": {}, 120 | "outputs": [ 121 | { 122 | "name": "stdout", 123 | "output_type": "stream", 124 | "text": [ 125 | "3 * 1 = 3\n", 126 | "3 * 2 = 6\n", 127 | "3 * 3 = 9\n", 128 | "3 * 4 = 12\n", 129 | "3 * 5 = 15\n", 130 | "3 * 6 = 18\n", 131 | "3 * 7 = 21\n", 132 | "3 * 8 = 24\n", 133 | "3 * 9 = 27\n", 134 | "3 * 10 = 30\n" 135 | ] 136 | } 137 | ], 138 | "source": [ 139 | "for i in range(1,100):\n", 140 | " if i == 11:\n", 141 | " break\n", 142 | " print('3 *',i,'= ',i*3)" 143 | ] 144 | }, 145 | { 146 | "cell_type": "code", 147 | "execution_count": 6, 148 | "id": "054e85e0", 149 | "metadata": {}, 150 | "outputs": [ 151 | { 152 | "name": "stdout", 153 | "output_type": "stream", 154 | "text": [ 155 | "5 * 1 = 3\n", 156 | "5 * 2 = 6\n", 157 | "5 * 3 = 9\n", 158 | "5 * 4 = 12\n", 159 | "5 * 5 = 15\n", 160 | "5 * 6 = 18\n", 161 | "5 * 7 = 21\n", 162 | "5 * 8 = 24\n", 163 | "5 * 9 = 27\n", 164 | "5 * 10 = 30\n" 165 | ] 166 | } 167 | ], 168 | "source": [ 169 | "i = 1\n", 170 | "while i<=100:\n", 171 | " if i==11:\n", 172 | " break\n", 173 | " print('5 *',i,'=',3*i)\n", 174 | " i = i+1" 175 | ] 176 | }, 177 | { 178 | "cell_type": "code", 179 | "execution_count": null, 180 | "id": "e250c0cd", 181 | "metadata": {}, 182 | "outputs": [], 183 | "source": [] 184 | } 185 | ], 186 | "metadata": { 187 | "kernelspec": { 188 | "display_name": "Python 3 (ipykernel)", 189 | "language": "python", 190 | "name": "python3" 191 | }, 192 | "language_info": { 193 | "codemirror_mode": { 194 | "name": "ipython", 195 | "version": 3 196 | }, 197 | "file_extension": ".py", 198 | "mimetype": "text/x-python", 199 | "name": "python", 200 | "nbconvert_exporter": "python", 201 | "pygments_lexer": "ipython3", 202 | "version": "3.9.13" 203 | } 204 | }, 205 | "nbformat": 4, 206 | "nbformat_minor": 5 207 | } 208 | -------------------------------------------------------------------------------- /Day 27 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "725858e8", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 1, 17 | "id": "dd0137f4", 18 | "metadata": {}, 19 | "outputs": [], 20 | "source": [ 21 | "num = [1,2,3,4,5,6,10,14,15]" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": 2, 27 | "id": "64b38e2e", 28 | "metadata": {}, 29 | "outputs": [ 30 | { 31 | "data": { 32 | "text/plain": [ 33 | "[1, 2, 3, 4, 5, 6, 10, 14, 15]" 34 | ] 35 | }, 36 | "execution_count": 2, 37 | "metadata": {}, 38 | "output_type": "execute_result" 39 | } 40 | ], 41 | "source": [ 42 | "num" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 4, 48 | "id": "960838d6", 49 | "metadata": {}, 50 | "outputs": [ 51 | { 52 | "data": { 53 | "text/plain": [ 54 | "[2, 4, 6, 10, 14]" 55 | ] 56 | }, 57 | "execution_count": 4, 58 | "metadata": {}, 59 | "output_type": "execute_result" 60 | } 61 | ], 62 | "source": [ 63 | "#list comp.\n", 64 | "[ i for i in num if i%2==0] #even" 65 | ] 66 | }, 67 | { 68 | "cell_type": "code", 69 | "execution_count": 9, 70 | "id": "a2259ed0", 71 | "metadata": {}, 72 | "outputs": [ 73 | { 74 | "name": "stdout", 75 | "output_type": "stream", 76 | "text": [ 77 | "2\n", 78 | "4\n", 79 | "6\n", 80 | "10\n", 81 | "14\n" 82 | ] 83 | } 84 | ], 85 | "source": [ 86 | "for i in num:\n", 87 | " if i%2==1:\n", 88 | " continue\n", 89 | " print(i)" 90 | ] 91 | }, 92 | { 93 | "cell_type": "code", 94 | "execution_count": 10, 95 | "id": "306cbff8", 96 | "metadata": {}, 97 | "outputs": [], 98 | "source": [ 99 | "sen = 'I love Bangladesh and Germany'\n" 100 | ] 101 | }, 102 | { 103 | "cell_type": "code", 104 | "execution_count": 11, 105 | "id": "9d038e51", 106 | "metadata": {}, 107 | "outputs": [ 108 | { 109 | "name": "stdout", 110 | "output_type": "stream", 111 | "text": [ 112 | "I\n", 113 | "love\n", 114 | "Bangladesh\n", 115 | "Germany\n" 116 | ] 117 | } 118 | ], 119 | "source": [ 120 | "for i in sen.split():\n", 121 | " if i=='and':\n", 122 | " continue\n", 123 | " print(i)" 124 | ] 125 | }, 126 | { 127 | "cell_type": "code", 128 | "execution_count": null, 129 | "id": "da89f4eb", 130 | "metadata": {}, 131 | "outputs": [], 132 | "source": [] 133 | } 134 | ], 135 | "metadata": { 136 | "kernelspec": { 137 | "display_name": "Python 3 (ipykernel)", 138 | "language": "python", 139 | "name": "python3" 140 | }, 141 | "language_info": { 142 | "codemirror_mode": { 143 | "name": "ipython", 144 | "version": 3 145 | }, 146 | "file_extension": ".py", 147 | "mimetype": "text/x-python", 148 | "name": "python", 149 | "nbconvert_exporter": "python", 150 | "pygments_lexer": "ipython3", 151 | "version": "3.9.13" 152 | } 153 | }, 154 | "nbformat": 4, 155 | "nbformat_minor": 5 156 | } 157 | -------------------------------------------------------------------------------- /Day 29 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "7fd76001", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "509f1769", 17 | "metadata": {}, 18 | "source": [ 19 | "# 1. Understanding Functions:" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "id": "b811bae7", 25 | "metadata": {}, 26 | "source": [ 27 | "-> A function is a block of organized, reusable code that performs a specific task.
\n", 28 | "-> Functions help in making your code modular, more readable, and easier to maintain." 29 | ] 30 | }, 31 | { 32 | "cell_type": "markdown", 33 | "id": "b2197ad3", 34 | "metadata": {}, 35 | "source": [ 36 | "# 2. Function Definition:" 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "id": "a379f653", 42 | "metadata": {}, 43 | "source": [ 44 | "To define a function, use the def keyword followed by the function name and parentheses. For example:" 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": 5, 50 | "id": "5329158b", 51 | "metadata": {}, 52 | "outputs": [], 53 | "source": [ 54 | "def dept():\n", 55 | " print('Data Science!')" 56 | ] 57 | }, 58 | { 59 | "cell_type": "markdown", 60 | "id": "2e46653b", 61 | "metadata": {}, 62 | "source": [ 63 | "# 3. Function Call" 64 | ] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "id": "3f8d6e9f", 69 | "metadata": {}, 70 | "source": [ 71 | "To execute a function, call it by using its name followed by parentheses:" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": 6, 77 | "id": "402aadc0", 78 | "metadata": {}, 79 | "outputs": [ 80 | { 81 | "name": "stdout", 82 | "output_type": "stream", 83 | "text": [ 84 | "Data Science!\n" 85 | ] 86 | } 87 | ], 88 | "source": [ 89 | "dept()" 90 | ] 91 | }, 92 | { 93 | "cell_type": "markdown", 94 | "id": "bc4c13d0", 95 | "metadata": {}, 96 | "source": [ 97 | "# 4. Parameters:" 98 | ] 99 | }, 100 | { 101 | "cell_type": "markdown", 102 | "id": "1ac37334", 103 | "metadata": {}, 104 | "source": [ 105 | "Functions can accept parameters (inputs). Parameters are variables that are used as placeholders for the actual values when the function is called." 106 | ] 107 | }, 108 | { 109 | "cell_type": "code", 110 | "execution_count": 8, 111 | "id": "fe6512e1", 112 | "metadata": {}, 113 | "outputs": [], 114 | "source": [ 115 | "def dept_with_names(name):\n", 116 | " print(f'My major is {name}')" 117 | ] 118 | }, 119 | { 120 | "cell_type": "markdown", 121 | "id": "68707756", 122 | "metadata": {}, 123 | "source": [ 124 | "You can call this function with a specific value:" 125 | ] 126 | }, 127 | { 128 | "cell_type": "code", 129 | "execution_count": 10, 130 | "id": "d3321636", 131 | "metadata": {}, 132 | "outputs": [ 133 | { 134 | "name": "stdout", 135 | "output_type": "stream", 136 | "text": [ 137 | "My major is Machine learning and ai\n" 138 | ] 139 | } 140 | ], 141 | "source": [ 142 | "dept_with_names('Machine learning and ai')" 143 | ] 144 | }, 145 | { 146 | "cell_type": "markdown", 147 | "id": "72c63953", 148 | "metadata": {}, 149 | "source": [ 150 | "# 5. Return Statement:" 151 | ] 152 | }, 153 | { 154 | "cell_type": "markdown", 155 | "id": "297e6b2e", 156 | "metadata": {}, 157 | "source": [ 158 | "Functions can return a value using the \"return\" statement. This is useful when you want to use the result of a function elsewhere in your code." 159 | ] 160 | }, 161 | { 162 | "cell_type": "code", 163 | "execution_count": 11, 164 | "id": "f586ba4b", 165 | "metadata": {}, 166 | "outputs": [], 167 | "source": [ 168 | "def name():\n", 169 | " print('shakil')\n", 170 | " return 1" 171 | ] 172 | }, 173 | { 174 | "cell_type": "code", 175 | "execution_count": 12, 176 | "id": "b155ffa4", 177 | "metadata": {}, 178 | "outputs": [ 179 | { 180 | "name": "stdout", 181 | "output_type": "stream", 182 | "text": [ 183 | "shakil\n" 184 | ] 185 | }, 186 | { 187 | "data": { 188 | "text/plain": [ 189 | "1" 190 | ] 191 | }, 192 | "execution_count": 12, 193 | "metadata": {}, 194 | "output_type": "execute_result" 195 | } 196 | ], 197 | "source": [ 198 | "name()" 199 | ] 200 | }, 201 | { 202 | "cell_type": "code", 203 | "execution_count": 13, 204 | "id": "db66aacd", 205 | "metadata": {}, 206 | "outputs": [], 207 | "source": [ 208 | "def name():\n", 209 | " return print('shakil')" 210 | ] 211 | }, 212 | { 213 | "cell_type": "code", 214 | "execution_count": 15, 215 | "id": "eea73f16", 216 | "metadata": {}, 217 | "outputs": [], 218 | "source": [ 219 | "def name():\n", 220 | " return dept()" 221 | ] 222 | }, 223 | { 224 | "cell_type": "code", 225 | "execution_count": 16, 226 | "id": "6990b94c", 227 | "metadata": {}, 228 | "outputs": [ 229 | { 230 | "name": "stdout", 231 | "output_type": "stream", 232 | "text": [ 233 | "Data Science!\n" 234 | ] 235 | } 236 | ], 237 | "source": [ 238 | "name()" 239 | ] 240 | }, 241 | { 242 | "cell_type": "markdown", 243 | "id": "ead0f606", 244 | "metadata": {}, 245 | "source": [ 246 | "# Question: 01" 247 | ] 248 | }, 249 | { 250 | "cell_type": "markdown", 251 | "id": "d0bf68cc", 252 | "metadata": {}, 253 | "source": [ 254 | "Write a function that wont take any parameters explicitly. Instead, it defines local variables a and b within the function and returns their sum. The values of a and b are fixed within the function." 255 | ] 256 | }, 257 | { 258 | "cell_type": "code", 259 | "execution_count": 17, 260 | "id": "35ebd46c", 261 | "metadata": {}, 262 | "outputs": [], 263 | "source": [ 264 | "def add_num():\n", 265 | " a = 10\n", 266 | " b = 20\n", 267 | " return a+b" 268 | ] 269 | }, 270 | { 271 | "cell_type": "code", 272 | "execution_count": 18, 273 | "id": "60f2fa6d", 274 | "metadata": {}, 275 | "outputs": [ 276 | { 277 | "data": { 278 | "text/plain": [ 279 | "30" 280 | ] 281 | }, 282 | "execution_count": 18, 283 | "metadata": {}, 284 | "output_type": "execute_result" 285 | } 286 | ], 287 | "source": [ 288 | "add_num()" 289 | ] 290 | }, 291 | { 292 | "cell_type": "code", 293 | "execution_count": 19, 294 | "id": "51d1ddc4", 295 | "metadata": {}, 296 | "outputs": [], 297 | "source": [ 298 | "def add_num():\n", 299 | " a = 10\n", 300 | " b = 20\n", 301 | " result = a+b\n", 302 | " return result" 303 | ] 304 | }, 305 | { 306 | "cell_type": "code", 307 | "execution_count": 20, 308 | "id": "f6416adc", 309 | "metadata": {}, 310 | "outputs": [ 311 | { 312 | "data": { 313 | "text/plain": [ 314 | "30" 315 | ] 316 | }, 317 | "execution_count": 20, 318 | "metadata": {}, 319 | "output_type": "execute_result" 320 | } 321 | ], 322 | "source": [ 323 | "add_num()" 324 | ] 325 | }, 326 | { 327 | "cell_type": "markdown", 328 | "id": "e275aa3d", 329 | "metadata": {}, 330 | "source": [ 331 | "# Question: 02" 332 | ] 333 | }, 334 | { 335 | "cell_type": "markdown", 336 | "id": "fafee974", 337 | "metadata": {}, 338 | "source": [ 339 | "Write a function that will take two parameters, a and b, and returns their sum. The values of a and b will not fixed within the function; they are determined by the arguments passed when the function is called. That will make the function more flexible because it can add any two numbers, not just the fixed values in the first function." 340 | ] 341 | }, 342 | { 343 | "cell_type": "code", 344 | "execution_count": 21, 345 | "id": "661fa40e", 346 | "metadata": {}, 347 | "outputs": [], 348 | "source": [ 349 | "def add_num(a, b):\n", 350 | " result = a+b\n", 351 | " return result" 352 | ] 353 | }, 354 | { 355 | "cell_type": "code", 356 | "execution_count": 23, 357 | "id": "f29c3dc3", 358 | "metadata": {}, 359 | "outputs": [ 360 | { 361 | "data": { 362 | "text/plain": [ 363 | "30" 364 | ] 365 | }, 366 | "execution_count": 23, 367 | "metadata": {}, 368 | "output_type": "execute_result" 369 | } 370 | ], 371 | "source": [ 372 | "add_num(10,20)" 373 | ] 374 | }, 375 | { 376 | "cell_type": "code", 377 | "execution_count": 24, 378 | "id": "a5db1bba", 379 | "metadata": {}, 380 | "outputs": [ 381 | { 382 | "data": { 383 | "text/plain": [ 384 | "90" 385 | ] 386 | }, 387 | "execution_count": 24, 388 | "metadata": {}, 389 | "output_type": "execute_result" 390 | } 391 | ], 392 | "source": [ 393 | "add_num(50, 40)" 394 | ] 395 | }, 396 | { 397 | "cell_type": "markdown", 398 | "id": "7fa29581", 399 | "metadata": {}, 400 | "source": [ 401 | "The key difference lies in the flexibility and reusability of the second function, which can add any two numbers based on the arguments provided, while the first function is limited to adding the fixed values a and b." 402 | ] 403 | } 404 | ], 405 | "metadata": { 406 | "kernelspec": { 407 | "display_name": "Python 3 (ipykernel)", 408 | "language": "python", 409 | "name": "python3" 410 | }, 411 | "language_info": { 412 | "codemirror_mode": { 413 | "name": "ipython", 414 | "version": 3 415 | }, 416 | "file_extension": ".py", 417 | "mimetype": "text/x-python", 418 | "name": "python", 419 | "nbconvert_exporter": "python", 420 | "pygments_lexer": "ipython3", 421 | "version": "3.9.13" 422 | } 423 | }, 424 | "nbformat": 4, 425 | "nbformat_minor": 5 426 | } 427 | -------------------------------------------------------------------------------- /Day 30 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "458feeeb", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "59cc7f91", 17 | "metadata": {}, 18 | "source": [ 19 | "# More about return" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 1, 25 | "id": "e8803bec", 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "def user_input():\n", 30 | " x1 = int(input())\n", 31 | " x2 = int(input())\n", 32 | " y1 = int(input())\n", 33 | " y2 = int(input())\n", 34 | " \n", 35 | " return x1, x2" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": 2, 41 | "id": "9833fdaa", 42 | "metadata": {}, 43 | "outputs": [ 44 | { 45 | "name": "stdout", 46 | "output_type": "stream", 47 | "text": [ 48 | "1\n", 49 | "2\n", 50 | "3\n", 51 | "4\n" 52 | ] 53 | }, 54 | { 55 | "data": { 56 | "text/plain": [ 57 | "(1, 2)" 58 | ] 59 | }, 60 | "execution_count": 2, 61 | "metadata": {}, 62 | "output_type": "execute_result" 63 | } 64 | ], 65 | "source": [ 66 | "user_input()" 67 | ] 68 | }, 69 | { 70 | "cell_type": "code", 71 | "execution_count": 3, 72 | "id": "d5773e5b", 73 | "metadata": {}, 74 | "outputs": [], 75 | "source": [ 76 | "def user_input():\n", 77 | " x1 = int(input())\n", 78 | " x2 = int(input())\n", 79 | " y1 = int(input())\n", 80 | " y2 = int(input())\n", 81 | " \n", 82 | " return x1, y1, x2, y2" 83 | ] 84 | }, 85 | { 86 | "cell_type": "code", 87 | "execution_count": 4, 88 | "id": "1dfe1d3d", 89 | "metadata": {}, 90 | "outputs": [ 91 | { 92 | "name": "stdout", 93 | "output_type": "stream", 94 | "text": [ 95 | "1\n", 96 | "3\n", 97 | "2\n", 98 | "4\n" 99 | ] 100 | }, 101 | { 102 | "data": { 103 | "text/plain": [ 104 | "(1, 2, 3, 4)" 105 | ] 106 | }, 107 | "execution_count": 4, 108 | "metadata": {}, 109 | "output_type": "execute_result" 110 | } 111 | ], 112 | "source": [ 113 | "user_input()" 114 | ] 115 | }, 116 | { 117 | "cell_type": "code", 118 | "execution_count": 5, 119 | "id": "ad7993d4", 120 | "metadata": {}, 121 | "outputs": [], 122 | "source": [ 123 | "def user_input():\n", 124 | " x1 = int(input())\n", 125 | " x2 = int(input())\n", 126 | " y1 = int(input())\n", 127 | " y2 = int(input())\n", 128 | " \n", 129 | " return (x1, y1), (x2, y2)" 130 | ] 131 | }, 132 | { 133 | "cell_type": "code", 134 | "execution_count": 6, 135 | "id": "8f2b1136", 136 | "metadata": {}, 137 | "outputs": [ 138 | { 139 | "name": "stdout", 140 | "output_type": "stream", 141 | "text": [ 142 | "1\n", 143 | "2\n", 144 | "3\n", 145 | "4\n" 146 | ] 147 | }, 148 | { 149 | "data": { 150 | "text/plain": [ 151 | "((1, 3), (2, 4))" 152 | ] 153 | }, 154 | "execution_count": 6, 155 | "metadata": {}, 156 | "output_type": "execute_result" 157 | } 158 | ], 159 | "source": [ 160 | "user_input()\n" 161 | ] 162 | }, 163 | { 164 | "cell_type": "code", 165 | "execution_count": 7, 166 | "id": "d3541083", 167 | "metadata": {}, 168 | "outputs": [], 169 | "source": [ 170 | "def user_input():\n", 171 | " x1 = int(input())\n", 172 | " x2 = int(input())\n", 173 | " y1 = int(input())\n", 174 | " y2 = int(input())\n", 175 | " \n", 176 | " return (x1, y1), (x2, y2)" 177 | ] 178 | }, 179 | { 180 | "cell_type": "code", 181 | "execution_count": 8, 182 | "id": "b077854c", 183 | "metadata": {}, 184 | "outputs": [ 185 | { 186 | "name": "stdout", 187 | "output_type": "stream", 188 | "text": [ 189 | "1\n", 190 | "2\n", 191 | "3\n", 192 | "4\n" 193 | ] 194 | } 195 | ], 196 | "source": [ 197 | "r1, r2 = user_input()" 198 | ] 199 | }, 200 | { 201 | "cell_type": "code", 202 | "execution_count": 9, 203 | "id": "a4471214", 204 | "metadata": {}, 205 | "outputs": [ 206 | { 207 | "data": { 208 | "text/plain": [ 209 | "(1, 3)" 210 | ] 211 | }, 212 | "execution_count": 9, 213 | "metadata": {}, 214 | "output_type": "execute_result" 215 | } 216 | ], 217 | "source": [ 218 | "r1" 219 | ] 220 | }, 221 | { 222 | "cell_type": "code", 223 | "execution_count": 10, 224 | "id": "3a6f0904", 225 | "metadata": {}, 226 | "outputs": [ 227 | { 228 | "data": { 229 | "text/plain": [ 230 | "(2, 4)" 231 | ] 232 | }, 233 | "execution_count": 10, 234 | "metadata": {}, 235 | "output_type": "execute_result" 236 | } 237 | ], 238 | "source": [ 239 | "r2" 240 | ] 241 | }, 242 | { 243 | "cell_type": "code", 244 | "execution_count": 11, 245 | "id": "61971425", 246 | "metadata": {}, 247 | "outputs": [], 248 | "source": [ 249 | "def user_input():\n", 250 | " x1 = int(input())\n", 251 | " x2 = int(input())\n", 252 | " y1 = int(input())\n", 253 | " y2 = int(input())\n", 254 | " \n", 255 | " return (x1, y1), (x2, y2)" 256 | ] 257 | }, 258 | { 259 | "cell_type": "code", 260 | "execution_count": 12, 261 | "id": "f7d3d110", 262 | "metadata": {}, 263 | "outputs": [ 264 | { 265 | "name": "stdout", 266 | "output_type": "stream", 267 | "text": [ 268 | "1\n", 269 | "2\n", 270 | "3\n", 271 | "4\n" 272 | ] 273 | } 274 | ], 275 | "source": [ 276 | "r1, _ = user_input()" 277 | ] 278 | }, 279 | { 280 | "cell_type": "code", 281 | "execution_count": 13, 282 | "id": "5097e583", 283 | "metadata": {}, 284 | "outputs": [ 285 | { 286 | "data": { 287 | "text/plain": [ 288 | "(1, 3)" 289 | ] 290 | }, 291 | "execution_count": 13, 292 | "metadata": {}, 293 | "output_type": "execute_result" 294 | } 295 | ], 296 | "source": [ 297 | "r1" 298 | ] 299 | }, 300 | { 301 | "cell_type": "code", 302 | "execution_count": 14, 303 | "id": "bc94086a", 304 | "metadata": {}, 305 | "outputs": [ 306 | { 307 | "name": "stdout", 308 | "output_type": "stream", 309 | "text": [ 310 | "1\n", 311 | "2\n", 312 | "3\n", 313 | "4\n" 314 | ] 315 | } 316 | ], 317 | "source": [ 318 | "r1 = user_input()" 319 | ] 320 | }, 321 | { 322 | "cell_type": "code", 323 | "execution_count": 15, 324 | "id": "58c4f515", 325 | "metadata": {}, 326 | "outputs": [ 327 | { 328 | "data": { 329 | "text/plain": [ 330 | "((1, 3), (2, 4))" 331 | ] 332 | }, 333 | "execution_count": 15, 334 | "metadata": {}, 335 | "output_type": "execute_result" 336 | } 337 | ], 338 | "source": [ 339 | "r1" 340 | ] 341 | }, 342 | { 343 | "cell_type": "code", 344 | "execution_count": 17, 345 | "id": "3daac1d8", 346 | "metadata": {}, 347 | "outputs": [ 348 | { 349 | "data": { 350 | "text/plain": [ 351 | "(9, 27)" 352 | ] 353 | }, 354 | "execution_count": 17, 355 | "metadata": {}, 356 | "output_type": "execute_result" 357 | } 358 | ], 359 | "source": [ 360 | "def sq_and_cube(x):\n", 361 | " sq = x**2\n", 362 | " cube = x**3\n", 363 | " return sq, cube\n", 364 | "\n", 365 | "sq_and_cube(3)" 366 | ] 367 | }, 368 | { 369 | "cell_type": "code", 370 | "execution_count": null, 371 | "id": "de759a70", 372 | "metadata": {}, 373 | "outputs": [], 374 | "source": [] 375 | } 376 | ], 377 | "metadata": { 378 | "kernelspec": { 379 | "display_name": "Python 3 (ipykernel)", 380 | "language": "python", 381 | "name": "python3" 382 | }, 383 | "language_info": { 384 | "codemirror_mode": { 385 | "name": "ipython", 386 | "version": 3 387 | }, 388 | "file_extension": ".py", 389 | "mimetype": "text/x-python", 390 | "name": "python", 391 | "nbconvert_exporter": "python", 392 | "pygments_lexer": "ipython3", 393 | "version": "3.9.13" 394 | } 395 | }, 396 | "nbformat": 4, 397 | "nbformat_minor": 5 398 | } 399 | -------------------------------------------------------------------------------- /Day 30.2 - More About Return.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "5e927ba6", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "def mulp():\n", 11 | " x = int(input('x = '))\n", 12 | " y = int(input('y = '))\n", 13 | " result = x*y\n", 14 | " print(result)" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 2, 20 | "id": "193bb52b", 21 | "metadata": {}, 22 | "outputs": [ 23 | { 24 | "name": "stdout", 25 | "output_type": "stream", 26 | "text": [ 27 | "x = 2\n", 28 | "y = 5\n", 29 | "10\n" 30 | ] 31 | } 32 | ], 33 | "source": [ 34 | "mulp()" 35 | ] 36 | }, 37 | { 38 | "cell_type": "code", 39 | "execution_count": 3, 40 | "id": "9823617d", 41 | "metadata": {}, 42 | "outputs": [], 43 | "source": [ 44 | "def mulp1():\n", 45 | " x = int(input('x = '))\n", 46 | " y = int(input('y = '))\n", 47 | " result = x*y\n", 48 | " print('result ', result)\n", 49 | " return result\n", 50 | " \n", 51 | "def mulp2():\n", 52 | " total1 = mulp1()\n", 53 | " z = int(input('z = '))\n", 54 | " total2 = total1 * z\n", 55 | " print('final result = ', total2)" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": 4, 61 | "id": "17a99bce", 62 | "metadata": {}, 63 | "outputs": [ 64 | { 65 | "name": "stdout", 66 | "output_type": "stream", 67 | "text": [ 68 | "x = 2\n", 69 | "y = 5\n", 70 | "result 10\n", 71 | "z = 10\n", 72 | "final result = 100\n" 73 | ] 74 | } 75 | ], 76 | "source": [ 77 | "mulp2()" 78 | ] 79 | }, 80 | { 81 | "cell_type": "markdown", 82 | "id": "45d3fed7", 83 | "metadata": {}, 84 | "source": [ 85 | "# separately" 86 | ] 87 | }, 88 | { 89 | "cell_type": "code", 90 | "execution_count": 5, 91 | "id": "ed85dd82", 92 | "metadata": {}, 93 | "outputs": [], 94 | "source": [ 95 | "def mulp1():\n", 96 | " x = int(input('x = '))\n", 97 | " y = int(input('y = '))\n", 98 | " result = x*y\n", 99 | " print('result ', result)\n", 100 | " return result" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": 6, 106 | "id": "f6070da6", 107 | "metadata": {}, 108 | "outputs": [], 109 | "source": [ 110 | "def mulp2():\n", 111 | " total1 = mulp1()\n", 112 | " z = int(input('z = '))\n", 113 | " total2 = total1 * z\n", 114 | " print('final result = ', total2)" 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "execution_count": 7, 120 | "id": "12a831f3", 121 | "metadata": {}, 122 | "outputs": [ 123 | { 124 | "name": "stdout", 125 | "output_type": "stream", 126 | "text": [ 127 | "x = 2\n", 128 | "y = 5\n", 129 | "result 10\n", 130 | "z = 10\n", 131 | "final result = 100\n" 132 | ] 133 | } 134 | ], 135 | "source": [ 136 | "mulp2()" 137 | ] 138 | }, 139 | { 140 | "cell_type": "code", 141 | "execution_count": null, 142 | "id": "a2191b77", 143 | "metadata": {}, 144 | "outputs": [], 145 | "source": [] 146 | } 147 | ], 148 | "metadata": { 149 | "kernelspec": { 150 | "display_name": "Python 3 (ipykernel)", 151 | "language": "python", 152 | "name": "python3" 153 | }, 154 | "language_info": { 155 | "codemirror_mode": { 156 | "name": "ipython", 157 | "version": 3 158 | }, 159 | "file_extension": ".py", 160 | "mimetype": "text/x-python", 161 | "name": "python", 162 | "nbconvert_exporter": "python", 163 | "pygments_lexer": "ipython3", 164 | "version": "3.9.13" 165 | } 166 | }, 167 | "nbformat": 4, 168 | "nbformat_minor": 5 169 | } 170 | -------------------------------------------------------------------------------- /Day 31 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "ceacc3e9", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "9456959d", 17 | "metadata": {}, 18 | "source": [ 19 | "# The Factorial" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 1, 25 | "id": "8007a427", 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "def fact(x):\n", 30 | " \n", 31 | " result = 1\n", 32 | " \n", 33 | " if x==1 or x==0:\n", 34 | " print(f'The {x}! is = 1')\n", 35 | " \n", 36 | " else:\n", 37 | " \n", 38 | " for i in range(x):\n", 39 | " result = result * (i+1)\n", 40 | " \n", 41 | " return result" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 2, 47 | "id": "79043235", 48 | "metadata": {}, 49 | "outputs": [ 50 | { 51 | "data": { 52 | "text/plain": [ 53 | "120" 54 | ] 55 | }, 56 | "execution_count": 2, 57 | "metadata": {}, 58 | "output_type": "execute_result" 59 | } 60 | ], 61 | "source": [ 62 | "fact(5)" 63 | ] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": null, 68 | "id": "23739ea7", 69 | "metadata": {}, 70 | "outputs": [], 71 | "source": [] 72 | } 73 | ], 74 | "metadata": { 75 | "kernelspec": { 76 | "display_name": "Python 3 (ipykernel)", 77 | "language": "python", 78 | "name": "python3" 79 | }, 80 | "language_info": { 81 | "codemirror_mode": { 82 | "name": "ipython", 83 | "version": 3 84 | }, 85 | "file_extension": ".py", 86 | "mimetype": "text/x-python", 87 | "name": "python", 88 | "nbconvert_exporter": "python", 89 | "pygments_lexer": "ipython3", 90 | "version": "3.9.13" 91 | } 92 | }, 93 | "nbformat": 4, 94 | "nbformat_minor": 5 95 | } 96 | -------------------------------------------------------------------------------- /Day 33 - 60 Days of Python - Breakup.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "80b6525d", 6 | "metadata": {}, 7 | "source": [ 8 | "Learn Data Science: https://aiquest.org/
\n", 9 | "Python for Everybody: https://aiquest.org/courses/python-for-everybody/
\n", 10 | "Join Facebook Group: https://www.facebook.com/groups/StudyMart
\n", 11 | "Cell/WhatsApp: +8801704265972" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "id": "e6ab2ce2", 17 | "metadata": {}, 18 | "source": [ 19 | "# Problem 1: List Sum" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "id": "8dfb3453", 25 | "metadata": {}, 26 | "source": [ 27 | "Write a Python function that takes a list of numbers as input and returns the sum of all the elements in the list.
\n", 28 | "input_numbers = [1, 2, 3, 4, 5]
\n", 29 | "Sum: 15" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": null, 35 | "id": "d41fd0cd", 36 | "metadata": {}, 37 | "outputs": [], 38 | "source": [ 39 | "def list_sum(input_numbers):\n", 40 | " " 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": null, 46 | "id": "d7ad7bf8", 47 | "metadata": {}, 48 | "outputs": [], 49 | "source": [] 50 | }, 51 | { 52 | "cell_type": "markdown", 53 | "id": "0392253b", 54 | "metadata": {}, 55 | "source": [ 56 | "# Problem 2: List Reversal" 57 | ] 58 | }, 59 | { 60 | "cell_type": "markdown", 61 | "id": "3be50e74", 62 | "metadata": {}, 63 | "source": [ 64 | "Create a function that reverses a given list and returns the reversed list.
\n", 65 | "original_list = [10, 20, 30, 40, 50]
\n", 66 | "Reversed List: [50, 40, 30, 20, 10]\n" 67 | ] 68 | }, 69 | { 70 | "cell_type": "code", 71 | "execution_count": null, 72 | "id": "6d0a5c4d", 73 | "metadata": {}, 74 | "outputs": [], 75 | "source": [ 76 | "def List_Reversal(original_list):\n", 77 | " " 78 | ] 79 | }, 80 | { 81 | "cell_type": "code", 82 | "execution_count": null, 83 | "id": "94c44207", 84 | "metadata": {}, 85 | "outputs": [], 86 | "source": [] 87 | }, 88 | { 89 | "cell_type": "markdown", 90 | "id": "bf298361", 91 | "metadata": {}, 92 | "source": [ 93 | "# Problem 3: List Even Numbers" 94 | ] 95 | }, 96 | { 97 | "cell_type": "markdown", 98 | "id": "ddf3d876", 99 | "metadata": {}, 100 | "source": [ 101 | "Write a function that takes a list of integers as input and returns a new list containing only the even numbers.
\n", 102 | "numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
\n", 103 | "Even Numbers: [2, 4, 6, 8, 10]" 104 | ] 105 | }, 106 | { 107 | "cell_type": "code", 108 | "execution_count": null, 109 | "id": "9fa29705", 110 | "metadata": {}, 111 | "outputs": [], 112 | "source": [ 113 | "def even_num(numbers):\n", 114 | " " 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "execution_count": null, 120 | "id": "ef510490", 121 | "metadata": {}, 122 | "outputs": [], 123 | "source": [] 124 | }, 125 | { 126 | "cell_type": "markdown", 127 | "id": "48d3d6f4", 128 | "metadata": {}, 129 | "source": [ 130 | "# Problem 4: List Duplicates" 131 | ] 132 | }, 133 | { 134 | "cell_type": "markdown", 135 | "id": "04676d7b", 136 | "metadata": {}, 137 | "source": [ 138 | "Create a function that finds and returns a list of unique elements from a given list.
\n", 139 | "elements = [1, 2, 2, 3, 4, 4, 5]
\n", 140 | "Unique Elements: [1, 2, 3, 4, 5]" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": null, 146 | "id": "1e4d1410", 147 | "metadata": {}, 148 | "outputs": [], 149 | "source": [ 150 | "def duplicates(elements):\n", 151 | " " 152 | ] 153 | }, 154 | { 155 | "cell_type": "code", 156 | "execution_count": null, 157 | "id": "283cd063", 158 | "metadata": {}, 159 | "outputs": [], 160 | "source": [] 161 | }, 162 | { 163 | "cell_type": "markdown", 164 | "id": "39af1384", 165 | "metadata": {}, 166 | "source": [ 167 | "# Problem 5: List Concatenation" 168 | ] 169 | }, 170 | { 171 | "cell_type": "markdown", 172 | "id": "36d0a6cc", 173 | "metadata": {}, 174 | "source": [ 175 | "Write a function that takes two lists as input and returns a new list that is the concatenation of the two input lists.
\n", 176 | "list1 = [1, 2, 3]
\n", 177 | "list2 = [4, 5, 6]
\n", 178 | "Concatenated List: [1, 2, 3, 4, 5, 6]\n", 179 | "\n" 180 | ] 181 | }, 182 | { 183 | "cell_type": "code", 184 | "execution_count": null, 185 | "id": "a948c128", 186 | "metadata": {}, 187 | "outputs": [], 188 | "source": [] 189 | }, 190 | { 191 | "cell_type": "code", 192 | "execution_count": null, 193 | "id": "aff73e5e", 194 | "metadata": {}, 195 | "outputs": [], 196 | "source": [] 197 | }, 198 | { 199 | "cell_type": "markdown", 200 | "id": "aab3c1bf", 201 | "metadata": {}, 202 | "source": [ 203 | "বিশেষ দ্রষ্টব্য: অবশ্যই আপনাকে মাথা খাটিয়ে উত্তরগুলো বের করতে হবে! যদি চোরামি করে সলিউশন বের করেন, তাহলে আপনার ব্রেকআপ হয়ে যাবে! সেক্ষেত্রে কর্তৃপক্ষ দায়ী থাকবে না! ধন্যবাদ!
\n", 204 | "-shakil vai" 205 | ] 206 | } 207 | ], 208 | "metadata": { 209 | "kernelspec": { 210 | "display_name": "Python 3 (ipykernel)", 211 | "language": "python", 212 | "name": "python3" 213 | }, 214 | "language_info": { 215 | "codemirror_mode": { 216 | "name": "ipython", 217 | "version": 3 218 | }, 219 | "file_extension": ".py", 220 | "mimetype": "text/x-python", 221 | "name": "python", 222 | "nbconvert_exporter": "python", 223 | "pygments_lexer": "ipython3", 224 | "version": "3.9.13" 225 | } 226 | }, 227 | "nbformat": 4, 228 | "nbformat_minor": 5 229 | } 230 | -------------------------------------------------------------------------------- /Day 34 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "d46ff95b", 6 | "metadata": {}, 7 | "source": [ 8 | "# Parameters Vs. Arguments?" 9 | ] 10 | }, 11 | { 12 | "cell_type": "markdown", 13 | "id": "e91a37c5", 14 | "metadata": {}, 15 | "source": [ 16 | "1. Parameters: These are the names listed in the function definition. They act as placeholders for the actual values that will be passed into the function when it is called. \n", 17 | "2. Arguments: These are the actual values that are passed to a function when it is called. Arguments are the values that replace the parameters when the function is invoked." 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 1, 23 | "id": "db4f5a4c", 24 | "metadata": {}, 25 | "outputs": [ 26 | { 27 | "data": { 28 | "text/plain": [ 29 | "40" 30 | ] 31 | }, 32 | "execution_count": 1, 33 | "metadata": {}, 34 | "output_type": "execute_result" 35 | } 36 | ], 37 | "source": [ 38 | "def add_num(x,y):\n", 39 | " result = x+y\n", 40 | " return result\n", 41 | "add_num(10, 30)" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 2, 47 | "id": "269e00d5", 48 | "metadata": {}, 49 | "outputs": [ 50 | { 51 | "name": "stdout", 52 | "output_type": "stream", 53 | "text": [ 54 | "10\n" 55 | ] 56 | } 57 | ], 58 | "source": [ 59 | "def add_num(x,y):\n", 60 | " print(x)\n", 61 | "add_num(10, 30)" 62 | ] 63 | }, 64 | { 65 | "cell_type": "markdown", 66 | "id": "338e3dfd", 67 | "metadata": {}, 68 | "source": [ 69 | "1. positional argument\n", 70 | "2. keyword argument\n", 71 | "3. default argument\n", 72 | "4. variable length argument" 73 | ] 74 | }, 75 | { 76 | "cell_type": "markdown", 77 | "id": "4d61ac93", 78 | "metadata": {}, 79 | "source": [ 80 | "# Positional argument" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": 3, 86 | "id": "5cc4f4de", 87 | "metadata": {}, 88 | "outputs": [ 89 | { 90 | "data": { 91 | "text/plain": [ 92 | "40" 93 | ] 94 | }, 95 | "execution_count": 3, 96 | "metadata": {}, 97 | "output_type": "execute_result" 98 | } 99 | ], 100 | "source": [ 101 | "def add_num(x,y):\n", 102 | " result = x+y\n", 103 | " return result\n", 104 | "add_num(10, 30)" 105 | ] 106 | }, 107 | { 108 | "cell_type": "markdown", 109 | "id": "a7d642d0", 110 | "metadata": {}, 111 | "source": [ 112 | "# Keyword argument" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 4, 118 | "id": "5a573cb9", 119 | "metadata": {}, 120 | "outputs": [ 121 | { 122 | "name": "stdout", 123 | "output_type": "stream", 124 | "text": [ 125 | "data scientist\n", 126 | "200000\n" 127 | ] 128 | } 129 | ], 130 | "source": [ 131 | "def personal(job, income):\n", 132 | " print(job)\n", 133 | " print(income)\n", 134 | "personal('data scientist', 200000)" 135 | ] 136 | }, 137 | { 138 | "cell_type": "code", 139 | "execution_count": 5, 140 | "id": "2f5da937", 141 | "metadata": {}, 142 | "outputs": [ 143 | { 144 | "name": "stdout", 145 | "output_type": "stream", 146 | "text": [ 147 | "job = data scientist\n", 148 | "income = 200000\n" 149 | ] 150 | } 151 | ], 152 | "source": [ 153 | "def personal(job, income):\n", 154 | " print('job = ',job)\n", 155 | " print('income =' ,income)\n", 156 | "personal(income=200000, job='data scientist')" 157 | ] 158 | }, 159 | { 160 | "cell_type": "markdown", 161 | "id": "8fa35698", 162 | "metadata": {}, 163 | "source": [ 164 | "# Default argument" 165 | ] 166 | }, 167 | { 168 | "cell_type": "code", 169 | "execution_count": 6, 170 | "id": "37900720", 171 | "metadata": {}, 172 | "outputs": [ 173 | { 174 | "name": "stdout", 175 | "output_type": "stream", 176 | "text": [ 177 | "job = DATA SCIENTIST\n", 178 | "income = 200000\n" 179 | ] 180 | } 181 | ], 182 | "source": [ 183 | "def personal(job, income=10000):\n", 184 | " print('job = ',job)\n", 185 | " \n", 186 | " print('income =' ,income)\n", 187 | "personal('DATA SCIENTIST', 200000)" 188 | ] 189 | }, 190 | { 191 | "cell_type": "markdown", 192 | "id": "b42f33b2", 193 | "metadata": {}, 194 | "source": [ 195 | "# Variable length argument" 196 | ] 197 | }, 198 | { 199 | "cell_type": "code", 200 | "execution_count": 7, 201 | "id": "b601f956", 202 | "metadata": {}, 203 | "outputs": [ 204 | { 205 | "name": "stdout", 206 | "output_type": "stream", 207 | "text": [ 208 | "(10, 30, 10, 1000, 4000)\n" 209 | ] 210 | }, 211 | { 212 | "data": { 213 | "text/plain": [ 214 | "5050" 215 | ] 216 | }, 217 | "execution_count": 7, 218 | "metadata": {}, 219 | "output_type": "execute_result" 220 | } 221 | ], 222 | "source": [ 223 | "def add_num(*x):\n", 224 | " print(x)\n", 225 | " result = sum(x)\n", 226 | " return result\n", 227 | " \n", 228 | "add_num(10, 30, 10, 1000,4000)" 229 | ] 230 | }, 231 | { 232 | "cell_type": "code", 233 | "execution_count": 8, 234 | "id": "3e16aa5d", 235 | "metadata": {}, 236 | "outputs": [ 237 | { 238 | "name": "stdout", 239 | "output_type": "stream", 240 | "text": [ 241 | "10\n", 242 | "(30, 10, 1000, 4000)\n" 243 | ] 244 | } 245 | ], 246 | "source": [ 247 | "def add_num(x, *y):\n", 248 | " print(x)\n", 249 | " print(y)\n", 250 | " \n", 251 | "add_num(10, 30, 10, 1000,4000)" 252 | ] 253 | }, 254 | { 255 | "cell_type": "code", 256 | "execution_count": null, 257 | "id": "bdb8cb3a", 258 | "metadata": {}, 259 | "outputs": [], 260 | "source": [] 261 | } 262 | ], 263 | "metadata": { 264 | "kernelspec": { 265 | "display_name": "Python 3 (ipykernel)", 266 | "language": "python", 267 | "name": "python3" 268 | }, 269 | "language_info": { 270 | "codemirror_mode": { 271 | "name": "ipython", 272 | "version": 3 273 | }, 274 | "file_extension": ".py", 275 | "mimetype": "text/x-python", 276 | "name": "python", 277 | "nbconvert_exporter": "python", 278 | "pygments_lexer": "ipython3", 279 | "version": "3.9.13" 280 | } 281 | }, 282 | "nbformat": 4, 283 | "nbformat_minor": 5 284 | } 285 | -------------------------------------------------------------------------------- /Day 35 - 60 Days of Python - parameters vs arguments.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "d46ff95b", 6 | "metadata": {}, 7 | "source": [ 8 | "# Parameters Vs. Arguments?" 9 | ] 10 | }, 11 | { 12 | "cell_type": "markdown", 13 | "id": "e91a37c5", 14 | "metadata": {}, 15 | "source": [ 16 | "1. Parameters: These are the names listed in the function definition. They act as placeholders for the actual values that will be passed into the function when it is called. \n", 17 | "2. Arguments: These are the actual values that are passed to a function when it is called. Arguments are the values that replace the parameters when the function is invoked." 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 1, 23 | "id": "db4f5a4c", 24 | "metadata": {}, 25 | "outputs": [ 26 | { 27 | "data": { 28 | "text/plain": [ 29 | "40" 30 | ] 31 | }, 32 | "execution_count": 1, 33 | "metadata": {}, 34 | "output_type": "execute_result" 35 | } 36 | ], 37 | "source": [ 38 | "def add_num(x,y):\n", 39 | " result = x+y\n", 40 | " return result\n", 41 | "add_num(10, 30)" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 2, 47 | "id": "269e00d5", 48 | "metadata": {}, 49 | "outputs": [ 50 | { 51 | "name": "stdout", 52 | "output_type": "stream", 53 | "text": [ 54 | "10\n" 55 | ] 56 | } 57 | ], 58 | "source": [ 59 | "def add_num(x,y):\n", 60 | " print(x)\n", 61 | "add_num(10, 30)" 62 | ] 63 | }, 64 | { 65 | "cell_type": "markdown", 66 | "id": "338e3dfd", 67 | "metadata": {}, 68 | "source": [ 69 | "1. positional argument\n", 70 | "2. keyword argument\n", 71 | "3. default argument\n", 72 | "4. variable length argument" 73 | ] 74 | }, 75 | { 76 | "cell_type": "markdown", 77 | "id": "4d61ac93", 78 | "metadata": {}, 79 | "source": [ 80 | "# Positional argument" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": 3, 86 | "id": "5cc4f4de", 87 | "metadata": {}, 88 | "outputs": [ 89 | { 90 | "data": { 91 | "text/plain": [ 92 | "40" 93 | ] 94 | }, 95 | "execution_count": 3, 96 | "metadata": {}, 97 | "output_type": "execute_result" 98 | } 99 | ], 100 | "source": [ 101 | "def add_num(x,y):\n", 102 | " result = x+y\n", 103 | " return result\n", 104 | "add_num(10, 30)" 105 | ] 106 | }, 107 | { 108 | "cell_type": "markdown", 109 | "id": "8fa35698", 110 | "metadata": {}, 111 | "source": [ 112 | "# Default argument" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 4, 118 | "id": "37900720", 119 | "metadata": {}, 120 | "outputs": [ 121 | { 122 | "name": "stdout", 123 | "output_type": "stream", 124 | "text": [ 125 | "job = DATA SCIENTIST\n", 126 | "income = 200000\n" 127 | ] 128 | } 129 | ], 130 | "source": [ 131 | "def personal(job, income=10000):\n", 132 | " print('job = ',job)\n", 133 | " print('income =' ,income)\n", 134 | "personal('DATA SCIENTIST', 200000)" 135 | ] 136 | }, 137 | { 138 | "cell_type": "markdown", 139 | "id": "b42f33b2", 140 | "metadata": {}, 141 | "source": [ 142 | "# Variable length argument" 143 | ] 144 | }, 145 | { 146 | "cell_type": "code", 147 | "execution_count": 5, 148 | "id": "b601f956", 149 | "metadata": {}, 150 | "outputs": [ 151 | { 152 | "name": "stdout", 153 | "output_type": "stream", 154 | "text": [ 155 | "(10, 30, 10, 1000, 4000)\n" 156 | ] 157 | }, 158 | { 159 | "data": { 160 | "text/plain": [ 161 | "5050" 162 | ] 163 | }, 164 | "execution_count": 5, 165 | "metadata": {}, 166 | "output_type": "execute_result" 167 | } 168 | ], 169 | "source": [ 170 | "def add_num(*x):\n", 171 | " print(x)\n", 172 | " result = sum(x)\n", 173 | " return result\n", 174 | " \n", 175 | "add_num(10, 30, 10, 1000,4000)" 176 | ] 177 | }, 178 | { 179 | "cell_type": "code", 180 | "execution_count": 6, 181 | "id": "3e16aa5d", 182 | "metadata": {}, 183 | "outputs": [ 184 | { 185 | "name": "stdout", 186 | "output_type": "stream", 187 | "text": [ 188 | "10\n", 189 | "(30, 10, 1000, 4000)\n" 190 | ] 191 | } 192 | ], 193 | "source": [ 194 | "def add_num(x, *y):\n", 195 | " print(x)\n", 196 | " print(y)\n", 197 | " \n", 198 | "add_num(10, 30, 10, 1000,4000)" 199 | ] 200 | }, 201 | { 202 | "cell_type": "markdown", 203 | "id": "a7d642d0", 204 | "metadata": {}, 205 | "source": [ 206 | "# Keyword argument" 207 | ] 208 | }, 209 | { 210 | "cell_type": "code", 211 | "execution_count": 7, 212 | "id": "2f5da937", 213 | "metadata": {}, 214 | "outputs": [ 215 | { 216 | "name": "stdout", 217 | "output_type": "stream", 218 | "text": [ 219 | "job = data scientist\n", 220 | "income = 200000\n" 221 | ] 222 | } 223 | ], 224 | "source": [ 225 | "def personal(job, income):\n", 226 | " print('job = ',job)\n", 227 | " print('income =' ,income)\n", 228 | "personal(income=200000, job='data scientist')" 229 | ] 230 | }, 231 | { 232 | "cell_type": "markdown", 233 | "id": "c4607bd8", 234 | "metadata": {}, 235 | "source": [ 236 | "# *args and **kwargs" 237 | ] 238 | }, 239 | { 240 | "cell_type": "code", 241 | "execution_count": 8, 242 | "id": "09a2418d", 243 | "metadata": {}, 244 | "outputs": [], 245 | "source": [ 246 | "# Keyworded variable-length argument (**kwargs)" 247 | ] 248 | }, 249 | { 250 | "cell_type": "markdown", 251 | "id": "0633a35b", 252 | "metadata": {}, 253 | "source": [ 254 | "Name: 'Rashedul Alam Shakil'
\n", 255 | "University: 'FAU'
\n", 256 | "City: 'Erlangen'" 257 | ] 258 | }, 259 | { 260 | "cell_type": "code", 261 | "execution_count": 9, 262 | "id": "f4ce7777", 263 | "metadata": {}, 264 | "outputs": [ 265 | { 266 | "name": "stdout", 267 | "output_type": "stream", 268 | "text": [ 269 | "Rashedul Alam Shakil\n", 270 | "('FAU', 'Erlangen')\n", 271 | "\n" 272 | ] 273 | } 274 | ], 275 | "source": [ 276 | "def personal_data(name, *arg):\n", 277 | " print(name)\n", 278 | " print(arg)\n", 279 | " print(type(arg))\n", 280 | "\n", 281 | "personal_data('Rashedul Alam Shakil', 'FAU','Erlangen')" 282 | ] 283 | }, 284 | { 285 | "cell_type": "code", 286 | "execution_count": 10, 287 | "id": "30555deb", 288 | "metadata": {}, 289 | "outputs": [ 290 | { 291 | "name": "stdout", 292 | "output_type": "stream", 293 | "text": [ 294 | "Rashedul Alam Shakil\n", 295 | "{'vrsity': 'FAU', 'city': 'Erlangen'}\n", 296 | "\n" 297 | ] 298 | } 299 | ], 300 | "source": [ 301 | "def personal_data(name, **arg):\n", 302 | " print(name)\n", 303 | " print(arg)\n", 304 | " print(type(arg))\n", 305 | "personal_data('Rashedul Alam Shakil', vrsity = 'FAU', city = 'Erlangen')" 306 | ] 307 | }, 308 | { 309 | "cell_type": "code", 310 | "execution_count": null, 311 | "id": "49272731", 312 | "metadata": {}, 313 | "outputs": [], 314 | "source": [] 315 | } 316 | ], 317 | "metadata": { 318 | "kernelspec": { 319 | "display_name": "Python 3 (ipykernel)", 320 | "language": "python", 321 | "name": "python3" 322 | }, 323 | "language_info": { 324 | "codemirror_mode": { 325 | "name": "ipython", 326 | "version": 3 327 | }, 328 | "file_extension": ".py", 329 | "mimetype": "text/x-python", 330 | "name": "python", 331 | "nbconvert_exporter": "python", 332 | "pygments_lexer": "ipython3", 333 | "version": "3.9.13" 334 | } 335 | }, 336 | "nbformat": 4, 337 | "nbformat_minor": 5 338 | } 339 | -------------------------------------------------------------------------------- /Day 36 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "15c0a973", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "# 5! = 5*4*3*2*1 = 120\n", 11 | "def facto(x):\n", 12 | " if x==0:\n", 13 | " return 1\n", 14 | " return x* facto(x-1)" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 2, 20 | "id": "f7a18e93", 21 | "metadata": {}, 22 | "outputs": [ 23 | { 24 | "data": { 25 | "text/plain": [ 26 | "120" 27 | ] 28 | }, 29 | "execution_count": 2, 30 | "metadata": {}, 31 | "output_type": "execute_result" 32 | } 33 | ], 34 | "source": [ 35 | "facto(5)" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": 3, 41 | "id": "d8b0a6cb", 42 | "metadata": {}, 43 | "outputs": [ 44 | { 45 | "name": "stdout", 46 | "output_type": "stream", 47 | "text": [ 48 | "aiquest.org\n" 49 | ] 50 | } 51 | ], 52 | "source": [ 53 | "def web():\n", 54 | " print('aiquest.org')\n", 55 | "web()" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": null, 61 | "id": "e37fe1bf", 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [ 65 | "def web():\n", 66 | " print('aiquest.org')\n", 67 | " web()\n", 68 | "web()" 69 | ] 70 | }, 71 | { 72 | "cell_type": "code", 73 | "execution_count": 1, 74 | "id": "06b48ab2", 75 | "metadata": {}, 76 | "outputs": [ 77 | { 78 | "data": { 79 | "text/plain": [ 80 | "3000" 81 | ] 82 | }, 83 | "execution_count": 1, 84 | "metadata": {}, 85 | "output_type": "execute_result" 86 | } 87 | ], 88 | "source": [ 89 | "import sys\n", 90 | "sys.getrecursionlimit()" 91 | ] 92 | }, 93 | { 94 | "cell_type": "code", 95 | "execution_count": null, 96 | "id": "5983b14c", 97 | "metadata": {}, 98 | "outputs": [], 99 | "source": [] 100 | } 101 | ], 102 | "metadata": { 103 | "kernelspec": { 104 | "display_name": "Python 3 (ipykernel)", 105 | "language": "python", 106 | "name": "python3" 107 | }, 108 | "language_info": { 109 | "codemirror_mode": { 110 | "name": "ipython", 111 | "version": 3 112 | }, 113 | "file_extension": ".py", 114 | "mimetype": "text/x-python", 115 | "name": "python", 116 | "nbconvert_exporter": "python", 117 | "pygments_lexer": "ipython3", 118 | "version": "3.9.13" 119 | } 120 | }, 121 | "nbformat": 4, 122 | "nbformat_minor": 5 123 | } 124 | -------------------------------------------------------------------------------- /Day 37 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "7f88a5d5", 6 | "metadata": {}, 7 | "source": [ 8 | "# Lambda Anonymous Function" 9 | ] 10 | }, 11 | { 12 | "cell_type": "markdown", 13 | "id": "7d46f348", 14 | "metadata": {}, 15 | "source": [ 16 | "lambda arguments: expression" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 1, 22 | "id": "20a44ff4", 23 | "metadata": {}, 24 | "outputs": [ 25 | { 26 | "data": { 27 | "text/plain": [ 28 | "9" 29 | ] 30 | }, 31 | "execution_count": 1, 32 | "metadata": {}, 33 | "output_type": "execute_result" 34 | } 35 | ], 36 | "source": [ 37 | "def sums(x,y):\n", 38 | " return x+y\n", 39 | "sums(4,5)" 40 | ] 41 | }, 42 | { 43 | "cell_type": "code", 44 | "execution_count": 2, 45 | "id": "37892a8e", 46 | "metadata": {}, 47 | "outputs": [ 48 | { 49 | "data": { 50 | "text/plain": [ 51 | "9" 52 | ] 53 | }, 54 | "execution_count": 2, 55 | "metadata": {}, 56 | "output_type": "execute_result" 57 | } 58 | ], 59 | "source": [ 60 | "f = lambda x,y: x+y\n", 61 | "f(4,5)" 62 | ] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": 3, 67 | "id": "d620625a", 68 | "metadata": {}, 69 | "outputs": [ 70 | { 71 | "data": { 72 | "text/plain": [ 73 | "20" 74 | ] 75 | }, 76 | "execution_count": 3, 77 | "metadata": {}, 78 | "output_type": "execute_result" 79 | } 80 | ], 81 | "source": [ 82 | "f = lambda x,y: x*y\n", 83 | "f(4,5)" 84 | ] 85 | }, 86 | { 87 | "cell_type": "code", 88 | "execution_count": 5, 89 | "id": "cfd227ac", 90 | "metadata": {}, 91 | "outputs": [ 92 | { 93 | "data": { 94 | "text/plain": [ 95 | "8" 96 | ] 97 | }, 98 | "execution_count": 5, 99 | "metadata": {}, 100 | "output_type": "execute_result" 101 | } 102 | ], 103 | "source": [ 104 | "f = lambda x: x+x\n", 105 | "f(4)" 106 | ] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "id": "bdcc493a", 111 | "metadata": {}, 112 | "source": [ 113 | "# Lambda in higher order" 114 | ] 115 | }, 116 | { 117 | "cell_type": "code", 118 | "execution_count": 6, 119 | "id": "6eb698a1", 120 | "metadata": {}, 121 | "outputs": [ 122 | { 123 | "data": { 124 | "text/plain": [ 125 | "9" 126 | ] 127 | }, 128 | "execution_count": 6, 129 | "metadata": {}, 130 | "output_type": "execute_result" 131 | } 132 | ], 133 | "source": [ 134 | "def operation_higher(x,y, operation):\n", 135 | " return operation(x,y)\n", 136 | "\n", 137 | "operation_higher(4,5, lambda x,y: x+y)" 138 | ] 139 | }, 140 | { 141 | "cell_type": "code", 142 | "execution_count": 7, 143 | "id": "5078f777", 144 | "metadata": {}, 145 | "outputs": [ 146 | { 147 | "data": { 148 | "text/plain": [ 149 | "20" 150 | ] 151 | }, 152 | "execution_count": 7, 153 | "metadata": {}, 154 | "output_type": "execute_result" 155 | } 156 | ], 157 | "source": [ 158 | "def operation_higher(x,y, operation):\n", 159 | " return operation(x,y)\n", 160 | "operation_higher(4,5, lambda x,y: x*y)" 161 | ] 162 | }, 163 | { 164 | "cell_type": "code", 165 | "execution_count": null, 166 | "id": "27f0b890", 167 | "metadata": {}, 168 | "outputs": [], 169 | "source": [] 170 | } 171 | ], 172 | "metadata": { 173 | "kernelspec": { 174 | "display_name": "Python 3 (ipykernel)", 175 | "language": "python", 176 | "name": "python3" 177 | }, 178 | "language_info": { 179 | "codemirror_mode": { 180 | "name": "ipython", 181 | "version": 3 182 | }, 183 | "file_extension": ".py", 184 | "mimetype": "text/x-python", 185 | "name": "python", 186 | "nbconvert_exporter": "python", 187 | "pygments_lexer": "ipython3", 188 | "version": "3.9.13" 189 | } 190 | }, 191 | "nbformat": 4, 192 | "nbformat_minor": 5 193 | } 194 | -------------------------------------------------------------------------------- /Day 38 - 60 Days of Python - map, filter, reduce.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "48701319", 6 | "metadata": {}, 7 | "source": [ 8 | "# Lambda with map(), filter(), reduce()" 9 | ] 10 | }, 11 | { 12 | "cell_type": "markdown", 13 | "id": "ace1c9e2", 14 | "metadata": {}, 15 | "source": [ 16 | "1. map(): when you want to apply a function to each element of an iterable and get a transformed iterable as a result
\n", 17 | "2. filter(): Use filter when you want to selectively include or exclude elements from an iterable based on a condition.
\n", 18 | "3. reduce(): Use reduce when you want to successively apply a binary function to the items of an iterable, reducing it to a single accumulated result." 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": 1, 24 | "id": "75bdbf25", 25 | "metadata": {}, 26 | "outputs": [ 27 | { 28 | "data": { 29 | "text/plain": [ 30 | "[1, 2, 4, 5, 7, 10]" 31 | ] 32 | }, 33 | "execution_count": 1, 34 | "metadata": {}, 35 | "output_type": "execute_result" 36 | } 37 | ], 38 | "source": [ 39 | "num = [1,2,4,5,7,10]\n", 40 | "num" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": 2, 46 | "id": "9bdde248", 47 | "metadata": {}, 48 | "outputs": [ 49 | { 50 | "data": { 51 | "text/plain": [ 52 | "27" 53 | ] 54 | }, 55 | "execution_count": 2, 56 | "metadata": {}, 57 | "output_type": "execute_result" 58 | } 59 | ], 60 | "source": [ 61 | "def sq(x):\n", 62 | " return x**x\n", 63 | "sq(3)" 64 | ] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": 3, 69 | "id": "c78ed3a1", 70 | "metadata": {}, 71 | "outputs": [ 72 | { 73 | "data": { 74 | "text/plain": [ 75 | "[1, 2, 4, 5, 7, 10]" 76 | ] 77 | }, 78 | "execution_count": 3, 79 | "metadata": {}, 80 | "output_type": "execute_result" 81 | } 82 | ], 83 | "source": [ 84 | "num = [1,2,4,5,7,10]\n", 85 | "num" 86 | ] 87 | }, 88 | { 89 | "cell_type": "code", 90 | "execution_count": 4, 91 | "id": "4a9e0f4b", 92 | "metadata": {}, 93 | "outputs": [ 94 | { 95 | "data": { 96 | "text/plain": [ 97 | "[1, 4, 16, 25, 49, 100]" 98 | ] 99 | }, 100 | "execution_count": 4, 101 | "metadata": {}, 102 | "output_type": "execute_result" 103 | } 104 | ], 105 | "source": [ 106 | "#map(function, iteable object)\n", 107 | "num = list(map(lambda x:x**2, num))\n", 108 | "num" 109 | ] 110 | }, 111 | { 112 | "cell_type": "code", 113 | "execution_count": 5, 114 | "id": "e978d1e1", 115 | "metadata": {}, 116 | "outputs": [ 117 | { 118 | "data": { 119 | "text/plain": [ 120 | "[1, 25, 49]" 121 | ] 122 | }, 123 | "execution_count": 5, 124 | "metadata": {}, 125 | "output_type": "execute_result" 126 | } 127 | ], 128 | "source": [ 129 | "#filter(function, iteable object)\n", 130 | "num = list(filter(lambda num: num%2==1, num))\n", 131 | "num" 132 | ] 133 | }, 134 | { 135 | "cell_type": "code", 136 | "execution_count": 6, 137 | "id": "7d680b62", 138 | "metadata": {}, 139 | "outputs": [ 140 | { 141 | "data": { 142 | "text/plain": [ 143 | "75" 144 | ] 145 | }, 146 | "execution_count": 6, 147 | "metadata": {}, 148 | "output_type": "execute_result" 149 | } 150 | ], 151 | "source": [ 152 | "from functools import reduce\n", 153 | "reduce(lambda a,b:a+b , num)" 154 | ] 155 | }, 156 | { 157 | "cell_type": "code", 158 | "execution_count": 7, 159 | "id": "b30df35f", 160 | "metadata": {}, 161 | "outputs": [ 162 | { 163 | "data": { 164 | "text/plain": [ 165 | "75" 166 | ] 167 | }, 168 | "execution_count": 7, 169 | "metadata": {}, 170 | "output_type": "execute_result" 171 | } 172 | ], 173 | "source": [ 174 | "sum(num)" 175 | ] 176 | }, 177 | { 178 | "cell_type": "code", 179 | "execution_count": null, 180 | "id": "8bf0b849", 181 | "metadata": {}, 182 | "outputs": [], 183 | "source": [] 184 | } 185 | ], 186 | "metadata": { 187 | "kernelspec": { 188 | "display_name": "Python 3 (ipykernel)", 189 | "language": "python", 190 | "name": "python3" 191 | }, 192 | "language_info": { 193 | "codemirror_mode": { 194 | "name": "ipython", 195 | "version": 3 196 | }, 197 | "file_extension": ".py", 198 | "mimetype": "text/x-python", 199 | "name": "python", 200 | "nbconvert_exporter": "python", 201 | "pygments_lexer": "ipython3", 202 | "version": "3.9.13" 203 | } 204 | }, 205 | "nbformat": 4, 206 | "nbformat_minor": 5 207 | } 208 | -------------------------------------------------------------------------------- /Day 39 - Demo file.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "bbb9b27e", 7 | "metadata": {}, 8 | "outputs": [ 9 | { 10 | "name": "stdout", 11 | "output_type": "stream", 12 | "text": [ 13 | "Overwriting test_module.py\n" 14 | ] 15 | } 16 | ], 17 | "source": [ 18 | "%%writefile test_module.py\n", 19 | "\n", 20 | "def greet(name):\n", 21 | " print(f'Hello, {name}!')\n", 22 | " \n", 23 | "def square(x):\n", 24 | " return x**2\n" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": null, 30 | "id": "0faf2eba", 31 | "metadata": {}, 32 | "outputs": [], 33 | "source": [] 34 | } 35 | ], 36 | "metadata": { 37 | "kernelspec": { 38 | "display_name": "Python 3 (ipykernel)", 39 | "language": "python", 40 | "name": "python3" 41 | }, 42 | "language_info": { 43 | "codemirror_mode": { 44 | "name": "ipython", 45 | "version": 3 46 | }, 47 | "file_extension": ".py", 48 | "mimetype": "text/x-python", 49 | "name": "python", 50 | "nbconvert_exporter": "python", 51 | "pygments_lexer": "ipython3", 52 | "version": "3.9.13" 53 | } 54 | }, 55 | "nbformat": 4, 56 | "nbformat_minor": 5 57 | } 58 | -------------------------------------------------------------------------------- /Day 39 - Main.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "5e4835c1", 7 | "metadata": {}, 8 | "outputs": [ 9 | { 10 | "name": "stdout", 11 | "output_type": "stream", 12 | "text": [ 13 | "Hello, shakil!\n" 14 | ] 15 | }, 16 | { 17 | "data": { 18 | "text/plain": [ 19 | "100" 20 | ] 21 | }, 22 | "execution_count": 1, 23 | "metadata": {}, 24 | "output_type": "execute_result" 25 | } 26 | ], 27 | "source": [ 28 | "import test_module\n", 29 | "test_module.greet('shakil')\n", 30 | "test_module.square(10)" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": 2, 36 | "id": "1b77a375", 37 | "metadata": {}, 38 | "outputs": [ 39 | { 40 | "name": "stdout", 41 | "output_type": "stream", 42 | "text": [ 43 | "Hello, shakil!\n" 44 | ] 45 | } 46 | ], 47 | "source": [ 48 | "from test_module import greet\n", 49 | "greet('shakil')\n", 50 | "#test_module.square(10)" 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": 3, 56 | "id": "fce11a41", 57 | "metadata": {}, 58 | "outputs": [ 59 | { 60 | "name": "stdout", 61 | "output_type": "stream", 62 | "text": [ 63 | "Hello, shakil!\n" 64 | ] 65 | }, 66 | { 67 | "data": { 68 | "text/plain": [ 69 | "100" 70 | ] 71 | }, 72 | "execution_count": 3, 73 | "metadata": {}, 74 | "output_type": "execute_result" 75 | } 76 | ], 77 | "source": [ 78 | "from test_module import greet, square\n", 79 | "greet('shakil')\n", 80 | "square(10)" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": 4, 86 | "id": "f3b874c2", 87 | "metadata": {}, 88 | "outputs": [ 89 | { 90 | "name": "stdout", 91 | "output_type": "stream", 92 | "text": [ 93 | "Hello, shakil!\n" 94 | ] 95 | }, 96 | { 97 | "data": { 98 | "text/plain": [ 99 | "100" 100 | ] 101 | }, 102 | "execution_count": 4, 103 | "metadata": {}, 104 | "output_type": "execute_result" 105 | } 106 | ], 107 | "source": [ 108 | "from test_module import *\n", 109 | "greet('shakil')\n", 110 | "square(10)" 111 | ] 112 | }, 113 | { 114 | "cell_type": "code", 115 | "execution_count": null, 116 | "id": "b26f2f2d", 117 | "metadata": {}, 118 | "outputs": [], 119 | "source": [] 120 | } 121 | ], 122 | "metadata": { 123 | "kernelspec": { 124 | "display_name": "Python 3 (ipykernel)", 125 | "language": "python", 126 | "name": "python3" 127 | }, 128 | "language_info": { 129 | "codemirror_mode": { 130 | "name": "ipython", 131 | "version": 3 132 | }, 133 | "file_extension": ".py", 134 | "mimetype": "text/x-python", 135 | "name": "python", 136 | "nbconvert_exporter": "python", 137 | "pygments_lexer": "ipython3", 138 | "version": "3.9.13" 139 | } 140 | }, 141 | "nbformat": 4, 142 | "nbformat_minor": 5 143 | } 144 | -------------------------------------------------------------------------------- /Day 40 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "e05be992", 7 | "metadata": {}, 8 | "outputs": [ 9 | { 10 | "name": "stdout", 11 | "output_type": "stream", 12 | "text": [ 13 | "Requirement already satisfied: pytube in c:\\users\\rashe\\anaconda3\\lib\\site-packages (15.0.0)\n" 14 | ] 15 | }, 16 | { 17 | "name": "stderr", 18 | "output_type": "stream", 19 | "text": [ 20 | "WARNING: Ignoring invalid distribution -rotobuf (c:\\users\\rashe\\anaconda3\\lib\\site-packages)\n", 21 | "WARNING: Ignoring invalid distribution -rotobuf (c:\\users\\rashe\\anaconda3\\lib\\site-packages)\n" 22 | ] 23 | } 24 | ], 25 | "source": [ 26 | "!pip install pytube" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 2, 32 | "id": "32f0cae1", 33 | "metadata": {}, 34 | "outputs": [], 35 | "source": [ 36 | "from pytube import YouTube" 37 | ] 38 | }, 39 | { 40 | "cell_type": "code", 41 | "execution_count": 3, 42 | "id": "fadeef66", 43 | "metadata": {}, 44 | "outputs": [], 45 | "source": [ 46 | "url = 'https://youtu.be/N8TuSqD7EcA'\n", 47 | "yt = YouTube(url)" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": 5, 53 | "id": "cd78ff8f", 54 | "metadata": {}, 55 | "outputs": [], 56 | "source": [ 57 | "stream = yt.streams.get_highest_resolution()" 58 | ] 59 | }, 60 | { 61 | "cell_type": "code", 62 | "execution_count": 6, 63 | "id": "75fd255d", 64 | "metadata": {}, 65 | "outputs": [ 66 | { 67 | "name": "stdout", 68 | "output_type": "stream", 69 | "text": [ 70 | "Donwload Completed\n" 71 | ] 72 | } 73 | ], 74 | "source": [ 75 | "stream.download()\n", 76 | "print('Donwload Completed')" 77 | ] 78 | }, 79 | { 80 | "cell_type": "code", 81 | "execution_count": 10, 82 | "id": "e0cde1b7", 83 | "metadata": {}, 84 | "outputs": [ 85 | { 86 | "name": "stdout", 87 | "output_type": "stream", 88 | "text": [ 89 | "4000p not available!\n" 90 | ] 91 | } 92 | ], 93 | "source": [ 94 | "stream = yt.streams.filter(progressive=True, res='720p').first()\n", 95 | "\n", 96 | "if stream:\n", 97 | " stream.download()\n", 98 | " print('Donwload Completed')\n", 99 | "else:\n", 100 | " print('720p not available!')" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": null, 106 | "id": "1d26b5b9", 107 | "metadata": {}, 108 | "outputs": [], 109 | "source": [ 110 | "stream = yt.streams.filter(progressive=True, res='4000p').first()\n", 111 | "\n", 112 | "if stream:\n", 113 | " stream.download()\n", 114 | " print('Donwload Completed')\n", 115 | "else:\n", 116 | " print('4000p not available!')" 117 | ] 118 | } 119 | ], 120 | "metadata": { 121 | "kernelspec": { 122 | "display_name": "Python 3 (ipykernel)", 123 | "language": "python", 124 | "name": "python3" 125 | }, 126 | "language_info": { 127 | "codemirror_mode": { 128 | "name": "ipython", 129 | "version": 3 130 | }, 131 | "file_extension": ".py", 132 | "mimetype": "text/x-python", 133 | "name": "python", 134 | "nbconvert_exporter": "python", 135 | "pygments_lexer": "ipython3", 136 | "version": "3.9.13" 137 | } 138 | }, 139 | "nbformat": 4, 140 | "nbformat_minor": 5 141 | } 142 | -------------------------------------------------------------------------------- /Day 41 - 60 Days of Python - Working with Files.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "89e4f216", 6 | "metadata": {}, 7 | "source": [ 8 | "# Example 1: Reading Text from a File" 9 | ] 10 | }, 11 | { 12 | "cell_type": "markdown", 13 | "id": "33f4f217", 14 | "metadata": {}, 15 | "source": [ 16 | "Before reading from a file, you need to make sure the file exists. This example will show you how to open a text file and read its contents line by line, which is useful for processing files that are too large to fit into memory all at once." 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 1, 22 | "id": "73522115", 23 | "metadata": {}, 24 | "outputs": [ 25 | { 26 | "name": "stdout", 27 | "output_type": "stream", 28 | "text": [ 29 | "We are allowing you to learn Python, Django, Machine Learning & AI. Visit: www.aiquest.org\n" 30 | ] 31 | } 32 | ], 33 | "source": [ 34 | "with open('py1.txt', 'r') as file:\n", 35 | " # Read each line in the file one at a time\n", 36 | " for line in file:\n", 37 | " # Process each line\n", 38 | " print(line.strip()) # The strip() method removes any leading/trailing whitespace & newline characters" 39 | ] 40 | }, 41 | { 42 | "cell_type": "markdown", 43 | "id": "38d358e2", 44 | "metadata": {}, 45 | "source": [ 46 | "This approach uses the \"with statement\" to ensure that the file is properly closed after its suite finishes, even if an exception is raised. It's a best practice for resource management." 47 | ] 48 | }, 49 | { 50 | "cell_type": "markdown", 51 | "id": "2c5f14a3", 52 | "metadata": {}, 53 | "source": [ 54 | "# Example 2: Writing Text to a File" 55 | ] 56 | }, 57 | { 58 | "cell_type": "markdown", 59 | "id": "649c69be", 60 | "metadata": {}, 61 | "source": [ 62 | "Write strings to a file, which is useful for logging, saving outputs, etc. We'll open a file in write mode ('w'), which creates the file if it doesn't exist or truncates it if it does." 63 | ] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": 2, 68 | "id": "9a8d9cdc", 69 | "metadata": {}, 70 | "outputs": [], 71 | "source": [ 72 | "lines_to_write = ['We are allowing you to learn Python, Django, Machine Learning & AI', 'Python makes file handling easy.','Visit: www.aiquest.org']" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": 3, 78 | "id": "cd953cc9", 79 | "metadata": {}, 80 | "outputs": [], 81 | "source": [ 82 | "# Open the file in write mode ('w')\n", 83 | "with open('py2.txt', 'w') as file:\n", 84 | " for line in lines_to_write:\n", 85 | " # Write each line to the file with a newline character at the end\n", 86 | " file.write(line + '\\n')" 87 | ] 88 | }, 89 | { 90 | "cell_type": "markdown", 91 | "id": "62fe6028", 92 | "metadata": {}, 93 | "source": [ 94 | "Using file.write() allows you to add text to a file. If you need to write multiple lines, you might use file.writelines() where you can pass a list of strings." 95 | ] 96 | }, 97 | { 98 | "cell_type": "code", 99 | "execution_count": 4, 100 | "id": "3c52d3dd", 101 | "metadata": {}, 102 | "outputs": [], 103 | "source": [ 104 | "# Open the file in write mode ('w')\n", 105 | "with open('py22.txt', 'w') as file:\n", 106 | " for line in lines_to_write:\n", 107 | " # Write each line to the file with a newline character at the end\n", 108 | " file.writelines(line + '\\n')" 109 | ] 110 | }, 111 | { 112 | "cell_type": "markdown", 113 | "id": "12412be6", 114 | "metadata": {}, 115 | "source": [ 116 | "# Example 3: Appending Text to an Existing File" 117 | ] 118 | }, 119 | { 120 | "cell_type": "markdown", 121 | "id": "3a3adf27", 122 | "metadata": {}, 123 | "source": [ 124 | "If you want to add text to the end of an existing file without overwriting its contents, you should open the file in append mode ('a'). This example demonstrates how to append multiple lines to an existing file." 125 | ] 126 | }, 127 | { 128 | "cell_type": "code", 129 | "execution_count": 5, 130 | "id": "cafea074", 131 | "metadata": {}, 132 | "outputs": [], 133 | "source": [ 134 | "new_text1 = ['Learn data science smartly', 'AI is Future']\n", 135 | "\n", 136 | "# Open the file in append mode ('a')\n", 137 | "with open('py22.txt', 'a') as file:\n", 138 | " for line in new_text1:\n", 139 | " # Append each line to the file\n", 140 | " file.write(line + '\\n')\n" 141 | ] 142 | }, 143 | { 144 | "cell_type": "markdown", 145 | "id": "f5e69ec5", 146 | "metadata": {}, 147 | "source": [ 148 | "This method is particularly useful for logging scenarios where new entries need to be added to a log file over time without losing the existing data." 149 | ] 150 | }, 151 | { 152 | "cell_type": "code", 153 | "execution_count": null, 154 | "id": "3eb074bc", 155 | "metadata": {}, 156 | "outputs": [], 157 | "source": [] 158 | } 159 | ], 160 | "metadata": { 161 | "kernelspec": { 162 | "display_name": "Python 3 (ipykernel)", 163 | "language": "python", 164 | "name": "python3" 165 | }, 166 | "language_info": { 167 | "codemirror_mode": { 168 | "name": "ipython", 169 | "version": 3 170 | }, 171 | "file_extension": ".py", 172 | "mimetype": "text/x-python", 173 | "name": "python", 174 | "nbconvert_exporter": "python", 175 | "pygments_lexer": "ipython3", 176 | "version": "3.9.13" 177 | } 178 | }, 179 | "nbformat": 4, 180 | "nbformat_minor": 5 181 | } 182 | -------------------------------------------------------------------------------- /Day 42 - 60 Days of Python - Working with PDFs.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "65dcb67e", 6 | "metadata": {}, 7 | "source": [ 8 | "# PDF Reader" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": 1, 14 | "id": "92302fc0", 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "# !pip install pypdf" 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": 2, 24 | "id": "a4aa7b0e", 25 | "metadata": {}, 26 | "outputs": [], 27 | "source": [ 28 | "from pypdf import PdfReader\n", 29 | "pdf = PdfReader('PyPrb.pdf')" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 3, 35 | "id": "f60a3ca3", 36 | "metadata": {}, 37 | "outputs": [ 38 | { 39 | "data": { 40 | "text/plain": [ 41 | "2" 42 | ] 43 | }, 44 | "execution_count": 3, 45 | "metadata": {}, 46 | "output_type": "execute_result" 47 | } 48 | ], 49 | "source": [ 50 | "len(pdf.pages)" 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": 4, 56 | "id": "67b279a3", 57 | "metadata": {}, 58 | "outputs": [ 59 | { 60 | "data": { 61 | "text/plain": [ 62 | "' \\nLearn data science: www.aiquest.org \\n \\nPython Conditions: \\n1. Take values of the length & breadth of a rectangle from user input and check if it is square or not. \\n2. Take three integer values from the user and print the greatest among them. \\n3. A student will not be allowed to sit in an exam if his/her attendance is less than 75%. \\n4. A school has the following rules for the grading system: \\nBelow 25 – F, 25 to 44 – E, 45 to 49 – D, 50 to 59 – C, 60 to 79 – B, 80 to 89 - A, Above 90 - A+ \\nNow, Ask the user to enter marks and print the corresponding grade. \\n \\nLoop Problem: \\n5. Print the following pattern using for and while loop . \\n1 2 3 4 5 6 7 \\n1 2 3 4 5 6 \\n1 2 3 4 5 \\n1 2 3 4 \\n6. Display numbers from -100 to -10 using for loop . \\n7. Write a program to sum all prime numbers within a range of 10 to 1000. \\n8. Find the factorial of an n! (Hint , n=7: 7*6*5*4*3*2*1) . \\n9. Reverse a given integer number 27956240710. \\n10. Print the following pattern using for and while loop . \\n# # # \\n# # # # \\n# # # \\n# # \\n11. Display the Fibonacci series of 15 element s using the for and while loop. \\n'" 63 | ] 64 | }, 65 | "execution_count": 4, 66 | "metadata": {}, 67 | "output_type": "execute_result" 68 | } 69 | ], 70 | "source": [ 71 | "page = pdf.pages[0]\n", 72 | "page.extract_text()" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": 5, 78 | "id": "b50d954e", 79 | "metadata": {}, 80 | "outputs": [], 81 | "source": [ 82 | "import PyPDF2" 83 | ] 84 | }, 85 | { 86 | "cell_type": "code", 87 | "execution_count": 6, 88 | "id": "0d375ea6", 89 | "metadata": {}, 90 | "outputs": [ 91 | { 92 | "name": "stdout", 93 | "output_type": "stream", 94 | "text": [ 95 | " \n", 96 | "Learn data science: www.aiquest.org \n", 97 | " \n", 98 | "Python Conditions: \n", 99 | "1. Take values of the length & breadth of a rectangle from user input and check if it is square or not. \n", 100 | "2. Take three integer values from the user and print the greatest among them. \n", 101 | "3. A student will not be allowed to sit in an exam if his/her attendance is less than 75%. \n", 102 | "4. A school has the following rules for the grading system: \n", 103 | "Below 25 – F, 25 to 44 – E, 45 to 49 – D, 50 to 59 – C, 60 to 79 – B, 80 to 89 - A, Above 90 - A+ \n", 104 | "Now, Ask the user to enter marks and print the corresponding grade. \n", 105 | " \n", 106 | "Loop Problem: \n", 107 | "5. Print the following pattern using for and while loop . \n", 108 | "1 2 3 4 5 6 7 \n", 109 | "1 2 3 4 5 6 \n", 110 | "1 2 3 4 5 \n", 111 | "1 2 3 4 \n", 112 | "6. Display numbers from -100 to -10 using for loop . \n", 113 | "7. Write a program to sum all prime numbers within a range of 10 to 1000. \n", 114 | "8. Find the factorial of an n! (Hint , n=7: 7*6*5*4*3*2*1) . \n", 115 | "9. Reverse a given integer number 27956240710. \n", 116 | "10. Print the following pattern using for and while loop . \n", 117 | "# # # \n", 118 | "# # # # \n", 119 | "# # # \n", 120 | "# # \n", 121 | "11. Display the Fibonacci series of 15 element s using the for and while loop. \n", 122 | "\n", 123 | "\n", 124 | "\n", 125 | "Python inbuilt Data Structure : \n", 126 | "12. Remove 2 and add 3 to the list and replace True with False. \n", 127 | "Li = [1, 3,5, [2,3], True] \n", 128 | "Output = [1,3,5, [3,3], False ] \n", 129 | "13. Find the intersection (common) of two sets. \n", 130 | "S1 = {1,4,6,8} \n", 131 | "S2 = {True, 1,2,10 } \n", 132 | "14. Input a list from the user then Remove duplicates from a list and create a set and find the max \n", 133 | "number . User_input = [1,9,3,4,5,200,54] \n", 134 | "15. Rename the key of a dictionary . \n", 135 | "Dict = { \"name\": \" Shakil \", \"age\":2 7, \"city\": “Berlin”, \"country \": \"Germany \" } \n", 136 | "Write a program to rename a key ‘country’ to a ‘region’ in the following dictionary. \n", 137 | "16. Creating a data frame using the list. \n", 138 | "num = [10,100,300] (column name is number ) \n", 139 | "17. Change the value of a key in a given dictionary. \n", 140 | "Write a Python program to change ‘age’ to 28 in the following dictionary. \n", 141 | "Dict = { \"name\": \" Shakil \", \"age\":2 7, \"city\": “Berlin”, \"country \": \"Germany \" } \n", 142 | " \n", 143 | "\n", 144 | "\n" 145 | ] 146 | } 147 | ], 148 | "source": [ 149 | "path = 'PyPrb.pdf'\n", 150 | "with open(path, \"rb\") as file:\n", 151 | " reader = PyPDF2.PdfReader(file)\n", 152 | " \n", 153 | " #first_page = reader.pages[1].extract_text()\n", 154 | " #print(first_page)\n", 155 | " \n", 156 | " for page in reader.pages:\n", 157 | " text = page.extract_text()\n", 158 | " print(text)\n", 159 | " print('\\n')\n" 160 | ] 161 | }, 162 | { 163 | "cell_type": "code", 164 | "execution_count": null, 165 | "id": "b06ce165", 166 | "metadata": {}, 167 | "outputs": [], 168 | "source": [] 169 | } 170 | ], 171 | "metadata": { 172 | "kernelspec": { 173 | "display_name": "Python 3 (ipykernel)", 174 | "language": "python", 175 | "name": "python3" 176 | }, 177 | "language_info": { 178 | "codemirror_mode": { 179 | "name": "ipython", 180 | "version": 3 181 | }, 182 | "file_extension": ".py", 183 | "mimetype": "text/x-python", 184 | "name": "python", 185 | "nbconvert_exporter": "python", 186 | "pygments_lexer": "ipython3", 187 | "version": "3.9.13" 188 | } 189 | }, 190 | "nbformat": 4, 191 | "nbformat_minor": 5 192 | } 193 | -------------------------------------------------------------------------------- /Day 43 - 60 Days of Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "e6c3ef53", 6 | "metadata": {}, 7 | "source": [ 8 | "# Generators in Python:\n", 9 | "\n", 10 | "Generator is a special type of iterator that allows you to iterate through a sequence of values one at a time, without having to store the entire sequence in memory at once. \n", 11 | "\n", 12 | "## What is a Generator?\n", 13 | "\n", 14 | "A generator is a function that returns an iterator object which we can iterate over (one value at a time). Generators are written like regular functions but use the `yield` statement whenever they want to return data. Each time `yield` is called, the generator function pauses and saves its state so that it can resume right where it left off on subsequent calls.\n", 15 | "\n", 16 | "## How to Create a Generator\n", 17 | "\n", 18 | "### Using Generator Functions\n", 19 | "\n", 20 | "A generator function is defined like a normal function but uses the `yield` statement to return values one at a time. After the `yield` keyword, the variable (or expression) that follows is the output produced by the generator. So, you can say that `yield` is a keyword that controls the data flow in a generator. \n", 21 | "\n", 22 | "```python\n", 23 | "def count_up_to(max):\n", 24 | " count = 1\n", 25 | " while count <= max:\n", 26 | " yield count\n", 27 | " count += 1\n", 28 | "\n", 29 | "counter = count_up_to(5)\n", 30 | "\n", 31 | "# Outputs\n", 32 | "print(next(counter)) # 1\n", 33 | "print(next(counter)) # 2\n", 34 | "print(next(counter)) # 3\n", 35 | "print(next(counter)) # 4\n", 36 | "print(next(counter)) # 5\n", 37 | "#print(next(counter)) # hoise ebar tham\n" 38 | ] 39 | }, 40 | { 41 | "cell_type": "markdown", 42 | "id": "31c1ce44", 43 | "metadata": {}, 44 | "source": [ 45 | "# List" 46 | ] 47 | }, 48 | { 49 | "cell_type": "code", 50 | "execution_count": 1, 51 | "id": "5684a15b", 52 | "metadata": {}, 53 | "outputs": [], 54 | "source": [ 55 | "def even_numbers_list(limit):\n", 56 | " numbers = []\n", 57 | " num = 0\n", 58 | " while num < limit:\n", 59 | " numbers.append(num)\n", 60 | " num += 2\n", 61 | " return numbers" 62 | ] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": 2, 67 | "id": "1af49811", 68 | "metadata": {}, 69 | "outputs": [ 70 | { 71 | "data": { 72 | "text/plain": [ 73 | "[0, 2, 4, 6, 8]" 74 | ] 75 | }, 76 | "execution_count": 2, 77 | "metadata": {}, 78 | "output_type": "execute_result" 79 | } 80 | ], 81 | "source": [ 82 | "evens = even_numbers_list(10) #range dite hobe\n", 83 | "evens" 84 | ] 85 | }, 86 | { 87 | "cell_type": "markdown", 88 | "id": "11994079", 89 | "metadata": {}, 90 | "source": [ 91 | "Suppose, you have a list of `n` data items and you want to use yield to create a generator that will yield each item from the list one by one." 92 | ] 93 | }, 94 | { 95 | "cell_type": "code", 96 | "execution_count": 3, 97 | "id": "45c76b1f", 98 | "metadata": {}, 99 | "outputs": [ 100 | { 101 | "name": "stdout", 102 | "output_type": "stream", 103 | "text": [ 104 | "10\n", 105 | "20\n", 106 | "30\n", 107 | "40\n", 108 | "50\n" 109 | ] 110 | } 111 | ], 112 | "source": [ 113 | "data_list = [10, 20, 30, 40, 50]\n", 114 | "\n", 115 | "def data_generator(data): # Generator function\n", 116 | " for item in data:\n", 117 | " yield item\n", 118 | "\n", 119 | "gen = data_generator(data_list) # creating generator\n", 120 | "\n", 121 | "for item in gen:\n", 122 | " print(item)" 123 | ] 124 | }, 125 | { 126 | "cell_type": "markdown", 127 | "id": "05484d83", 128 | "metadata": {}, 129 | "source": [ 130 | "## Why Use `yield`?\n", 131 | "\n", 132 | "- **Memory Efficiency**: It avoids the need to store large data sets in memory.\n", 133 | "- **Lazy Evaluation**: Values are generated only as needed.\n", 134 | "- **Simpler Code**: Writing a generator function is often more straightforward and readable than manually managing state with an iterator class.\n", 135 | "- **Infinite Sequences**: Generators can represent infinite sequences, producing values on-demand without running out of memory.\n" 136 | ] 137 | }, 138 | { 139 | "cell_type": "code", 140 | "execution_count": 4, 141 | "id": "3fb9b0ca", 142 | "metadata": {}, 143 | "outputs": [], 144 | "source": [ 145 | "import sys" 146 | ] 147 | }, 148 | { 149 | "cell_type": "code", 150 | "execution_count": 5, 151 | "id": "ed8b6e3c", 152 | "metadata": {}, 153 | "outputs": [ 154 | { 155 | "data": { 156 | "text/plain": [ 157 | "[0, 2, 4, 6, 8]" 158 | ] 159 | }, 160 | "execution_count": 5, 161 | "metadata": {}, 162 | "output_type": "execute_result" 163 | } 164 | ], 165 | "source": [ 166 | "evens" 167 | ] 168 | }, 169 | { 170 | "cell_type": "code", 171 | "execution_count": 6, 172 | "id": "f4bc49af", 173 | "metadata": {}, 174 | "outputs": [ 175 | { 176 | "data": { 177 | "text/plain": [ 178 | "120" 179 | ] 180 | }, 181 | "execution_count": 6, 182 | "metadata": {}, 183 | "output_type": "execute_result" 184 | } 185 | ], 186 | "source": [ 187 | "sys.getsizeof(evens)" 188 | ] 189 | }, 190 | { 191 | "cell_type": "code", 192 | "execution_count": 7, 193 | "id": "a2eaff96", 194 | "metadata": {}, 195 | "outputs": [ 196 | { 197 | "name": "stdout", 198 | "output_type": "stream", 199 | "text": [ 200 | "0\n", 201 | "2\n", 202 | "4\n", 203 | "6\n", 204 | "8\n", 205 | "10\n", 206 | "12\n", 207 | "14\n", 208 | "16\n", 209 | "18\n" 210 | ] 211 | } 212 | ], 213 | "source": [ 214 | "def even_numbers():\n", 215 | " num = 0\n", 216 | " while True:\n", 217 | " \n", 218 | " yield num\n", 219 | " num += 2\n", 220 | "\n", 221 | "gen = even_numbers()\n", 222 | "\n", 223 | "for _ in range(10):\n", 224 | " print(next(gen))\n" 225 | ] 226 | }, 227 | { 228 | "cell_type": "code", 229 | "execution_count": 8, 230 | "id": "2a456612", 231 | "metadata": {}, 232 | "outputs": [ 233 | { 234 | "data": { 235 | "text/plain": [ 236 | "112" 237 | ] 238 | }, 239 | "execution_count": 8, 240 | "metadata": {}, 241 | "output_type": "execute_result" 242 | } 243 | ], 244 | "source": [ 245 | "sys.getsizeof(gen)" 246 | ] 247 | }, 248 | { 249 | "cell_type": "markdown", 250 | "id": "70e4e7c8", 251 | "metadata": {}, 252 | "source": [ 253 | "# Without yield" 254 | ] 255 | }, 256 | { 257 | "cell_type": "markdown", 258 | "id": "68f47e85", 259 | "metadata": {}, 260 | "source": [ 261 | "You can directly access the data of a generator expression, but you need to understand that a generator produces values on-the-fly and doesn't store them all at once. This is why you can't directly access specific elements or get the length of a generator like you can with lists or tuples. Instead, you need to iterate through the generator to get its values." 262 | ] 263 | }, 264 | { 265 | "cell_type": "code", 266 | "execution_count": 9, 267 | "id": "71f4a960", 268 | "metadata": {}, 269 | "outputs": [ 270 | { 271 | "data": { 272 | "text/plain": [ 273 | " at 0x000002419F463BA0>" 274 | ] 275 | }, 276 | "execution_count": 9, 277 | "metadata": {}, 278 | "output_type": "execute_result" 279 | } 280 | ], 281 | "source": [ 282 | "ev_gen = (x for x in range(10) if x%2==0)\n", 283 | "ev_gen" 284 | ] 285 | }, 286 | { 287 | "cell_type": "code", 288 | "execution_count": 10, 289 | "id": "64af1bb0", 290 | "metadata": {}, 291 | "outputs": [ 292 | { 293 | "data": { 294 | "text/plain": [ 295 | "112" 296 | ] 297 | }, 298 | "execution_count": 10, 299 | "metadata": {}, 300 | "output_type": "execute_result" 301 | } 302 | ], 303 | "source": [ 304 | "sys.getsizeof(ev_gen)" 305 | ] 306 | }, 307 | { 308 | "cell_type": "code", 309 | "execution_count": 11, 310 | "id": "c3377cae", 311 | "metadata": {}, 312 | "outputs": [ 313 | { 314 | "name": "stdout", 315 | "output_type": "stream", 316 | "text": [ 317 | "0\n", 318 | "2\n", 319 | "4\n", 320 | "6\n", 321 | "8\n" 322 | ] 323 | } 324 | ], 325 | "source": [ 326 | "for num in ev_gen:\n", 327 | " print(num)" 328 | ] 329 | }, 330 | { 331 | "cell_type": "code", 332 | "execution_count": 12, 333 | "id": "e2a31ef6", 334 | "metadata": {}, 335 | "outputs": [ 336 | { 337 | "name": "stdout", 338 | "output_type": "stream", 339 | "text": [ 340 | "0\n", 341 | "1\n", 342 | "4\n", 343 | "9\n", 344 | "16\n", 345 | "25\n", 346 | "36\n", 347 | "49\n", 348 | "64\n", 349 | "81\n" 350 | ] 351 | } 352 | ], 353 | "source": [ 354 | "squares_gen = (x**2 for x in range(10))\n", 355 | "\n", 356 | "for square in squares_gen:\n", 357 | " print(square)\n" 358 | ] 359 | }, 360 | { 361 | "cell_type": "code", 362 | "execution_count": 13, 363 | "id": "8e196364", 364 | "metadata": {}, 365 | "outputs": [ 366 | { 367 | "data": { 368 | "text/plain": [ 369 | "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" 370 | ] 371 | }, 372 | "execution_count": 13, 373 | "metadata": {}, 374 | "output_type": "execute_result" 375 | } 376 | ], 377 | "source": [ 378 | "[x**2 for x in range(10)]" 379 | ] 380 | }, 381 | { 382 | "cell_type": "code", 383 | "execution_count": 14, 384 | "id": "fce18263", 385 | "metadata": {}, 386 | "outputs": [ 387 | { 388 | "name": "stdout", 389 | "output_type": "stream", 390 | "text": [ 391 | "0\n", 392 | "2\n", 393 | "4\n", 394 | "6\n", 395 | "8\n" 396 | ] 397 | }, 398 | { 399 | "data": { 400 | "text/plain": [ 401 | "[None, None, None, None, None]" 402 | ] 403 | }, 404 | "execution_count": 14, 405 | "metadata": {}, 406 | "output_type": "execute_result" 407 | } 408 | ], 409 | "source": [ 410 | "[print(x) for x in range(10) if x%2==0]" 411 | ] 412 | }, 413 | { 414 | "cell_type": "code", 415 | "execution_count": 15, 416 | "id": "60adb567", 417 | "metadata": {}, 418 | "outputs": [ 419 | { 420 | "data": { 421 | "text/plain": [ 422 | "112" 423 | ] 424 | }, 425 | "execution_count": 15, 426 | "metadata": {}, 427 | "output_type": "execute_result" 428 | } 429 | ], 430 | "source": [ 431 | "sys.getsizeof(ev_gen)" 432 | ] 433 | }, 434 | { 435 | "cell_type": "markdown", 436 | "id": "fbf6561a", 437 | "metadata": {}, 438 | "source": [ 439 | "# List Comprehensions vs Generators in Python\n", 440 | "\n", 441 | "Both list comprehensions and generators provide concise ways to create iterators in Python. However, they serve different purposes and have different characteristics.\n", 442 | "\n", 443 | "## List Comprehensions\n", 444 | "\n", 445 | "List comprehensions are a compact way to create lists. They are enclosed in square brackets `[]` and can include conditions and nested loops.\n", 446 | "\n", 447 | "### Syntax\n", 448 | "\n", 449 | "```python\n", 450 | "[expression for item in iterable if condition] #List Comprehension\n", 451 | "(expression for item in iterable if condition) #Generator\n" 452 | ] 453 | }, 454 | { 455 | "cell_type": "markdown", 456 | "id": "25abfbb0", 457 | "metadata": {}, 458 | "source": [ 459 | "| Feature | List Comprehensions | Generators |\n", 460 | "|--------------------------|------------------------------------------|---------------------------------------------|\n", 461 | "| **Syntax** | `[expression for item in iterable]` | `(expression for item in iterable)` |\n", 462 | "| **Evaluation** | Immediate (all items at once) | Lazy (one item at a time) |\n", 463 | "| **Memory Usage** | Stores entire list in memory | Memory efficient (no storage of entire list)|\n", 464 | "| **Iteration** | Can be iterated multiple times | Can be iterated only once |\n", 465 | "| **Use Case** | Small to medium-sized lists | Large datasets or infinite sequences |\n", 466 | "| **Speed** | Faster for small datasets | Generally slower due to lazy evaluation |\n" 467 | ] 468 | }, 469 | { 470 | "cell_type": "code", 471 | "execution_count": 16, 472 | "id": "014336f6", 473 | "metadata": {}, 474 | "outputs": [ 475 | { 476 | "data": { 477 | "text/plain": [ 478 | "[0, 4, 16, 36, 64]" 479 | ] 480 | }, 481 | "execution_count": 16, 482 | "metadata": {}, 483 | "output_type": "execute_result" 484 | } 485 | ], 486 | "source": [ 487 | "# List comprehension\n", 488 | "even_squares = [x**2 for x in range(10) if x % 2 == 0]\n", 489 | "even_squares" 490 | ] 491 | }, 492 | { 493 | "cell_type": "code", 494 | "execution_count": 17, 495 | "id": "4aa47902", 496 | "metadata": {}, 497 | "outputs": [ 498 | { 499 | "name": "stdout", 500 | "output_type": "stream", 501 | "text": [ 502 | "0\n", 503 | "4\n", 504 | "16\n", 505 | "36\n", 506 | "64\n" 507 | ] 508 | } 509 | ], 510 | "source": [ 511 | "# Generator expression\n", 512 | "even_squares_gen = (x**2 for x in range(10) if x % 2 == 0)\n", 513 | "\n", 514 | "for square in even_squares_gen:\n", 515 | " print(square)" 516 | ] 517 | }, 518 | { 519 | "cell_type": "code", 520 | "execution_count": 18, 521 | "id": "9e14a4d0", 522 | "metadata": {}, 523 | "outputs": [ 524 | { 525 | "name": "stdout", 526 | "output_type": "stream", 527 | "text": [ 528 | "List comprehension = 120\n", 529 | "Generator = 112\n" 530 | ] 531 | } 532 | ], 533 | "source": [ 534 | "print('List comprehension =',sys.getsizeof(even_squares))\n", 535 | "print('Generator =',sys.getsizeof(even_squares_gen))" 536 | ] 537 | }, 538 | { 539 | "cell_type": "code", 540 | "execution_count": 19, 541 | "id": "5fe2a0a8", 542 | "metadata": {}, 543 | "outputs": [ 544 | { 545 | "data": { 546 | "text/plain": [ 547 | "(0, 4, 16, 36, 64)" 548 | ] 549 | }, 550 | "execution_count": 19, 551 | "metadata": {}, 552 | "output_type": "execute_result" 553 | } 554 | ], 555 | "source": [ 556 | "even_squares_tuple = tuple(x**2 for x in range(10) if x % 2 == 0)\n", 557 | "even_squares_tuple" 558 | ] 559 | }, 560 | { 561 | "cell_type": "code", 562 | "execution_count": 20, 563 | "id": "b23c3749", 564 | "metadata": {}, 565 | "outputs": [ 566 | { 567 | "data": { 568 | "text/plain": [ 569 | "[0, 4, 16, 36, 64]" 570 | ] 571 | }, 572 | "execution_count": 20, 573 | "metadata": {}, 574 | "output_type": "execute_result" 575 | } 576 | ], 577 | "source": [ 578 | "even_squares_list = list(x**2 for x in range(10) if x % 2 == 0)\n", 579 | "even_squares_list" 580 | ] 581 | }, 582 | { 583 | "cell_type": "code", 584 | "execution_count": null, 585 | "id": "a129805b", 586 | "metadata": {}, 587 | "outputs": [], 588 | "source": [] 589 | } 590 | ], 591 | "metadata": { 592 | "kernelspec": { 593 | "display_name": "Python 3 (ipykernel)", 594 | "language": "python", 595 | "name": "python3" 596 | }, 597 | "language_info": { 598 | "codemirror_mode": { 599 | "name": "ipython", 600 | "version": 3 601 | }, 602 | "file_extension": ".py", 603 | "mimetype": "text/x-python", 604 | "name": "python", 605 | "nbconvert_exporter": "python", 606 | "pygments_lexer": "ipython3", 607 | "version": "3.9.13" 608 | } 609 | }, 610 | "nbformat": 4, 611 | "nbformat_minor": 5 612 | } 613 | -------------------------------------------------------------------------------- /OOP in Python.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rashakil-ds/60-Days-of-Python-by-Study-Mart-AI-QUEST/206265c75faf11936079af3bbaf4c6e6330884a6/OOP in Python.pdf -------------------------------------------------------------------------------- /Python Problems.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rashakil-ds/60-Days-of-Python-by-Study-Mart-AI-QUEST/206265c75faf11936079af3bbaf4c6e6330884a6/Python Problems.pdf -------------------------------------------------------------------------------- /Python Roadmap.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rashakil-ds/60-Days-of-Python-by-Study-Mart-AI-QUEST/206265c75faf11936079af3bbaf4c6e6330884a6/Python Roadmap.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 60 Days of Python by Study Mart & aiQuest Intelligence 5 | 6 | 7 |

60 Days of Python by Study Mart & aiQuest Intelligence

8 |

Welcome to the 60 Days of Python repository! This repository contains 60 video materials ranging from basic to advanced Python, curated by Study Mart and aiQuest Intelligence.

9 | 10 |

Course Name

11 |

60 Days of Python

12 | 13 |

Topics Covered

14 |
    15 |
  • Basic Python Programming
  • 16 |
  • Intermediate Python Concepts
  • 17 |
  • Advanced Python Techniques
  • 18 |
19 | 20 |

YouTube Video Playlist

21 |

Watch the complete video playlist on YouTube: 60 Days of Python Playlist

22 | 23 |

Repository Link

24 |

Check out the collection of video materials here.

25 | 26 |

Additional Resources

27 |

We also offer a variety of paid courses on data science on our website. Visit AIQuest for more details.

28 |

For free resources, check out our YouTube channel: StudyMart.

29 |

Join our Facebook group for more discussions and resources: StudyMart Facebook Group.

30 | 31 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /test: -------------------------------------------------------------------------------- 1 | 2 | --------------------------------------------------------------------------------