├── 000_Intro_to_Python.ipynb ├── 001_Python_Programming.ipynb ├── 002_How_to_install_Python.ipynb ├── 003_Jupyter_Keyboard_Shortcuts_Practice.ipynb ├── 004_Hello_World.ipynb ├── 005_Python_Keywords_and_Identifiers.ipynb ├── 006_Python_Statement_Indentation_Comments.ipynb ├── 007_Python_Variables_&_Constants.ipynb ├── 3.Theory - PYTHON FULL STACK (1).pdf ├── Data Types ├── Python Data Types - Boolean.ipynb ├── Python Data Types - Dictionary.ipynb ├── Python Data Types - Numeric.ipynb ├── Python Data Types - Set.ipynb ├── Python Data Types - Tuples.ipynb ├── Python Data Types -LIST.ipynb └── Python Data Types -String.ipynb ├── Deployment_labs_set`1 ├── Bank │ ├── Bank.py │ ├── Templates │ │ └── index.html │ ├── a545.py │ └── index.html ├── Cal_Area_2 │ ├── Area.py │ └── Templates │ │ └── index_rectangle.html ├── Celicius to fr_1 │ ├── Templates │ │ └── index_temperature.html │ └── cal.py ├── Lab_Files.ipynb └── Random Password_3 │ ├── Random.py │ └── Templates │ └── index_password.html ├── Function_Problem.md ├── Functions ├── 001_Python_Functions.ipynb ├── 002_Python_Function_Global_Local_Nonlocal.ipynb ├── 002_Python_Functions_Built_in │ ├── 001_Python_Functions.ipynb │ ├── 001_Python_abs().ipynb │ ├── 002_Python_any().ipynb │ ├── 002_Seaborn_Controlling_Aesthetics.ipynb │ ├── 003_Python_all().ipynb │ ├── 004_Python_ascii().ipynb │ ├── 005_Python_bin().ipynb │ ├── 006_Python_bool().ipynb │ ├── 007_Python_bytearray().ipynb │ ├── 008_Python_callable().ipynb │ ├── 009_Python_String_format().ipynb │ ├── 009_Python_bytes().ipynb │ ├── 010_Python_chr().ipynb │ ├── 011_Python_compile().ipynb │ ├── 012_Python_classmethod().ipynb │ ├── 013_Python_complex().ipynb │ ├── 014_Python_delattr().ipynb │ ├── 015_Python_dict().ipynb │ ├── 016_Python_dir().ipynb │ ├── 017_Python_divmod().ipynb │ ├── 018_Python_enumerate().ipynb │ ├── 019_Python_staticmethod().ipynb │ ├── 020_Python_filter().ipynb │ ├── 021_Python_eval().ipynb │ ├── 022_Python_float().ipynb │ ├── 023_Python_format().ipynb │ ├── 024_Python_frozenset().ipynb │ ├── 025_Python_getattr().ipynb │ ├── 026_Python_globals().ipynb │ ├── 027_Python_exec().ipynb │ ├── 028_Python_hasattr().ipynb │ ├── 029_Python_help().ipynb │ ├── 030_Python_hex().ipynb │ ├── 031_Python_hash().ipynb │ ├── 032_Python_input().ipynb │ ├── 033_Python_id().ipynb │ ├── 034_Python_isinstance().ipynb │ ├── 035_Python_int().ipynb │ ├── 036_Python_issubclass().ipynb │ ├── 037_Python_iter().ipynb │ ├── 038_Python_list()_Function.ipynb │ ├── 039_Python_locals().ipynb │ ├── 040_Python_len().ipynb │ ├── 041_Python_max().ipynb │ ├── 042_Python_min().ipynb │ ├── 043_Python_map().ipynb │ ├── 044_Python_memoryview().ipynb │ ├── 045_Python_next().ipynb │ ├── 046_Python_object().ipynb │ ├── 047_Python_oct().ipynb │ ├── 048_Python_ord().ipynb │ ├── 049_Python_open().ipynb │ ├── 050_Python_pow().ipynb │ ├── 051_Python_print().ipynb │ ├── 052_Python_property().ipynb │ ├── 053_Python_range().ipynb │ ├── 054_Python_repr().ipynb │ ├── 055_Python_reversed().ipynb │ ├── 056_Python_round().ipynb │ ├── 057_Python_set().ipynb │ ├── 058_Python_setattr().ipynb │ ├── 059_Python_slice().ipynb │ ├── 060_Python_sorted().ipynb │ ├── 061_Python_str().ipynb │ ├── 062_Python_sum().ipynb │ ├── 063_Python_tuple()_Function.ipynb │ ├── 064_Python_type().ipynb │ ├── 065_Python_vars().ipynb │ ├── 066_Python_zip().ipynb │ ├── 068_Python_super().ipynb │ ├── README.md │ ├── README.txt │ ├── img │ │ ├── r1.png │ │ └── r2.png │ ├── python.txt │ └── test.txt ├── 005_Python_Function_Recursion.ipynb ├── 006_Python_Function_Anonymous.ipynb ├── 007_Python_Function_Module.ipynb ├── 008_Python_Function_random_Module.ipynb ├── 009_Python_Function_math_Module.ipynb.ipynb ├── 010_Python_Function_Package.ipynb ├── Keyword and In built Function In python.ipynb ├── Problem_Function.md └── img │ ├── anaconda_prompt.png │ ├── dnld_rep.png │ ├── f1.png │ ├── f2.png │ ├── fun.png │ ├── pack1.png │ ├── re1.png │ └── re2.png ├── Gurupatil0003-main └── Gurupatil0003-main │ ├── 197375.png │ ├── 197375.svg │ ├── 197408.png │ ├── 197408.svg │ ├── 197484.png │ ├── 197484.svg │ ├── 197571.png │ ├── 197571.svg │ ├── 3898082.png │ ├── 3898082.svg │ ├── 3909444.png │ ├── 3909444.svg │ ├── Developer.gif │ ├── Earth.gif │ ├── Handshake.gif │ ├── Neo.gif │ ├── README.md │ ├── Readme_1 │ ├── blob-sunglasses.gif │ ├── build_readme.py │ ├── catfly.gif │ ├── colaborate.gif │ ├── corona.gif │ ├── doubt.gif │ ├── flaticons.txt │ ├── hello.gif │ ├── hyperkitty.gif │ ├── letterbox.gif │ ├── lightning.gif │ ├── message.gif │ ├── requirements.txt │ ├── wink.gif │ └── write.gif ├── Impact Training Schedule (2024-25) (UPDATED).xlsx ├── Lab - PYTHON FULL STACK.pdf ├── Lab_files ├── Lab.md ├── Set1_Lab_Files_Solution (1).ipynb ├── employee_data_large.xlsx ├── example_data.csv └── set_2_lab_EXp.ipynb ├── Modules and Packages ├── Matplot.md ├── Ploty.md ├── README (3).md ├── numpy.md └── seaborn.md ├── Object-Oriented-Programming-Concepts └── imgs │ ├── 003_Python_Inheritance (1).ipynb │ ├── 003_Python_Inheritance (3).ipynb │ ├── 003_Python_Inheritance.ipynb │ ├── Abstraction_Python.ipynb │ ├── Constructor in Python.ipynb │ ├── Encapsulation.ipynb │ ├── Polymorphism_Python.ipynb │ ├── README.md │ ├── imgs │ ├── MRO.png │ ├── OOPAbstraction.png │ ├── OOPClass.png │ ├── OOPConcepts.png │ ├── OOPEncapsulation.png │ ├── OOPInheritance.png │ ├── OOPObject.png │ ├── OOPPolymorphism.png │ ├── OOPStructre.png │ ├── classobj.png │ ├── dnld_rep.png │ ├── encap.png │ ├── encapsulation_python_class.jpg │ ├── hbi.png │ ├── hi.png │ ├── i.png │ ├── instvarmeth.png │ ├── mli.png │ ├── mo.png │ ├── mpi.png │ ├── objr.png │ ├── polymor.png │ ├── python_data_hiding.jpg │ └── si.png │ └── python_data_hiding.jpg ├── Operators_python ├── 04 B104_Python 1_Arithmaticoperations.ipynb ├── 1 Arithmatic Operators.ipynb ├── 10 .Escape operator.ipynb ├── 2 Comparison operator Relational Operators.ipynb ├── 3 Assignment Operators.ipynb ├── 4. Logical Operators.ipynb ├── 6. Membership Operators.ipynb └── 7. Identity Operators.ipynb ├── Programming_Fundamentals_Impact_Lesson_Plan (1) (1).pdf ├── QuetionBank.md ├── README.MD ├── README.md ├── Set1_Lab_Files_Solution.ipynb ├── conditionals statements and loops ├── 01 Controlled Structure For Loop.ipynb ├── 05 Controlled Structure Nested For Loop.ipynb ├── 06 Controlled Structure While Loop.ipynb ├── Control Structure If else statements (2).ipynb └── Control Structure If else statements (3).ipynb ├── http Methods_in_Flask ├── Templates │ ├── df.html │ └── l.html └── a.py ├── img ├── A1.png ├── A2.png ├── A3.png ├── A4.png ├── A5.png ├── A6.png ├── A7.png ├── A8.png ├── IvsC.png ├── c1.png ├── c2.png ├── c3.png ├── c4.png ├── dnld_rep.png ├── format1.png ├── format2.png ├── h1.png ├── h2.png ├── i1.png ├── i2.png ├── icon.png ├── icon48.png ├── ind1.png ├── ind2.png ├── jupyter.png ├── k1.png ├── k2.png ├── left.png ├── li0.png ├── li1.png ├── li10.png ├── li2.png ├── li3.png ├── li4.png ├── li5.png ├── li6.png ├── li7.png ├── li8.png ├── li9.png ├── logo.png ├── ns1.png ├── ns2.png ├── op1.png ├── op10.png ├── op11.png ├── op12.png ├── op13.png ├── op14.png ├── op2.png ├── op3.png ├── op4.png ├── op5.png ├── op6.png ├── op7.png ├── op8.png ├── op9.png ├── p1.png ├── p2.png ├── p3.png ├── p4.png ├── p5.png ├── p6.png ├── palette.gif ├── ps1.png ├── ps2.png ├── ps3.png ├── ps4.png ├── right.png ├── setup1.png ├── setup2.png ├── setup3.png ├── setup4.png ├── v1.png ├── v10.png ├── v11.png ├── v12.png ├── v13.png ├── v14.png ├── v15.png ├── v16.png ├── v17.png ├── v18.png ├── v19.png ├── v2.png ├── v20.png ├── v3.png ├── v4.png ├── v5.png ├── v6.png ├── v7.png ├── v8.png ├── v9.png └── youtube.png └── python Handling Exception and Handling Files ├── 001_Python_File_Input_Output (1).ipynb ├── Python Exception Handling (1).ipynb ├── change_greenscreen (1).ipynb └── img ├── background_01.jpg ├── candies.jpg ├── house.jpg ├── pexels-athena-1758144.jpg ├── pexels-konstantin-mishchenko-1926769.jpg ├── th (2).jpeg ├── van_damme.png └── vandamme_house.png /3.Theory - PYTHON FULL STACK (1).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/3.Theory - PYTHON FULL STACK (1).pdf -------------------------------------------------------------------------------- /Deployment_labs_set`1/Bank/Bank.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request 2 | 3 | app = Flask(__name__) 4 | 5 | class BankAccount: 6 | def __init__(self, account_number, balance=0): 7 | self.account_number = account_number 8 | self.balance = balance 9 | 10 | def deposit(self, amount): 11 | self.balance += amount 12 | return f"Deposited ${amount}. New balance: ${self.balance}" 13 | 14 | def withdraw(self, amount): 15 | if amount <= self.balance: 16 | self.balance -= amount 17 | return f"Withdrew ${amount}. New balance: ${self.balance}" 18 | else: 19 | return "Insufficient funds." 20 | 21 | # Initialize a bank account for demonstration 22 | sample_account = BankAccount("12345") 23 | 24 | @app.route('/') 25 | def index(): 26 | return render_template('index.html', balance=sample_account.balance) 27 | 28 | @app.route('/deposit', methods=['POST']) 29 | def deposit(): 30 | amount = float(request.form['amount']) 31 | message = sample_account.deposit(amount) 32 | return render_template('index.html', message=message, balance=sample_account.balance) 33 | 34 | @app.route('/withdraw', methods=['POST']) 35 | def withdraw(): 36 | amount = float(request.form['amount']) 37 | message = sample_account.withdraw(amount) 38 | return render_template('index.html', message=message, balance=sample_account.balance) 39 | 40 | if __name__ == '__main__': 41 | app.run(debug=True) 42 | -------------------------------------------------------------------------------- /Deployment_labs_set`1/Bank/Templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bank Account Management 7 | 8 | 9 |

Bank Account Management

10 |

Current Balance: ${{ balance }}

11 | 12 |

Actions

13 | 17 | 18 | {% if message %} 19 |

{{ message }}

20 | {% endif %} 21 | 22 |

Deposit

23 |
24 | 25 | 26 | 27 |
28 | 29 |

Withdraw

30 |
31 | 32 | 33 | 34 |
35 | 36 | 37 | -------------------------------------------------------------------------------- /Deployment_labs_set`1/Bank/a545.py: -------------------------------------------------------------------------------- 1 | a=6 2 | print(a) 3 | -------------------------------------------------------------------------------- /Deployment_labs_set`1/Bank/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bank Account Management 7 | 8 | 9 |

Bank Account Management

10 |

Current Balance: ${{ balance }}

11 | 12 |

Actions

13 | 17 | 18 | {% if message %} 19 |

{{ message }}

20 | {% endif %} 21 | 22 |

Deposit

23 |
24 | 25 | 26 | 27 |
28 | 29 |

Withdraw

30 |
31 | 32 | 33 | 34 |
35 | 36 | 37 | -------------------------------------------------------------------------------- /Deployment_labs_set`1/Cal_Area_2/Area.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request 2 | 3 | app = Flask(__name__) 4 | 5 | @app.route('/') 6 | def index(): 7 | return render_template('index_rectangle.html') 8 | 9 | @app.route('/calculate', methods=['POST']) 10 | def calculate(): 11 | length = float(request.form['length']) 12 | width = float(request.form['width']) 13 | 14 | area = length * width 15 | perimeter = 2 * (length + width) 16 | 17 | return render_template('index_rectangle.html', length=length, width=width, area=area, perimeter=perimeter) 18 | 19 | if __name__ == '__main__': 20 | app.run(debug=True) 21 | -------------------------------------------------------------------------------- /Deployment_labs_set`1/Cal_Area_2/Templates/index_rectangle.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Rectangle Calculator 7 | 104 | 105 | 106 |

Rectangle Calculator

107 | 108 |
109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 |
117 | 118 | {% if area is defined and perimeter is defined %} 119 |

Area: {{ area }}, Perimeter: {{ perimeter }}

120 | {% endif %} 121 | 122 | 125 | 126 | 127 | Learn More 128 | 129 | 130 | -------------------------------------------------------------------------------- /Deployment_labs_set`1/Celicius to fr_1/Templates/index_temperature.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Temperature Converter 7 | 72 | 73 | 74 |

Temperature Converter

75 | 76 |
77 | 78 | 79 | 80 | 81 | 85 | 86 | 87 | 91 | 92 | 93 |
94 | 95 | {% if temperature %} 96 |

{{ temperature }} {{ from_unit }} is equal to {{ converted_temperature }} {{ to_unit }}.

97 |

Back to Conversion Page

98 | {% endif %} 99 | 100 | 101 | -------------------------------------------------------------------------------- /Deployment_labs_set`1/Celicius to fr_1/cal.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request 2 | 3 | app = Flask(__name__) 4 | 5 | def fahrenheit_to_celsius(fahrenheit): 6 | return (fahrenheit - 32) * 5/9 7 | 8 | def celsius_to_fahrenheit(celsius): 9 | return celsius * 9/5 + 32 10 | 11 | @app.route('/') 12 | def index(): 13 | return render_template('index_temperature.html') 14 | 15 | @app.route('/convert', methods=['POST']) 16 | def convert(): 17 | temperature = float(request.form['temperature']) 18 | from_unit = request.form['from_unit'] 19 | to_unit = request.form['to_unit'] 20 | 21 | if from_unit == 'fahrenheit' and to_unit == 'celsius': 22 | converted_temperature = fahrenheit_to_celsius(temperature) 23 | elif from_unit == 'celsius' and to_unit == 'fahrenheit': 24 | converted_temperature = celsius_to_fahrenheit(temperature) 25 | else: 26 | converted_temperature = temperature # No conversion needed 27 | 28 | return render_template('index_temperature.html', temperature=temperature, 29 | from_unit=from_unit, to_unit=to_unit, 30 | converted_temperature=converted_temperature) 31 | 32 | if __name__ == '__main__': 33 | app.run(debug=True) 34 | -------------------------------------------------------------------------------- /Deployment_labs_set`1/Random Password_3/Random.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request 2 | import random 3 | import string 4 | 5 | app = Flask(__name__) 6 | 7 | def generate_password(length): 8 | characters = string.ascii_letters + string.digits + string.punctuation 9 | password = ''.join(random.choice(characters) for _ in range(length)) 10 | return password 11 | 12 | @app.route('/') 13 | def index(): 14 | return render_template('index_password.html') 15 | 16 | @app.route('/generate', methods=['POST']) 17 | def generate(): 18 | length = int(request.form['length']) 19 | password = generate_password(length) 20 | return render_template('index_password.html', password=password, length=length) 21 | 22 | if __name__ == '__main__': 23 | app.run(debug=True) 24 | -------------------------------------------------------------------------------- /Deployment_labs_set`1/Random Password_3/Templates/index_password.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Random Password Generator 7 | 104 | 105 | 106 |

Random Password Generator

107 | 108 |
109 | 110 | 111 | 112 | 113 |
114 | 115 | {% if password is defined %} 116 |

Your Random Password:

117 |

{{ password }}

118 | {% endif %} 119 | 120 | 123 | 124 | 125 | Learn More 126 | 127 | 128 | -------------------------------------------------------------------------------- /Function_Problem.md: -------------------------------------------------------------------------------- 1 | Exercise 1: Define a function that accepts 2 values and return its sum, subtraction and multiplication. 2 | Hint 3 | Input: 4 | Enter value of a = 7 5 | Enter value of b = 5 6 | 7 | Expected output 8 | Sum is = 12 9 | Sub is = 2 10 | Multiplication is = 35 11 | 12 | 13 | ```python 14 | AIzaSyB_V3DqJiHPzsbklDmkQQNnSORGPTNnNyo 15 | 16 | ``` 17 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/001_Python_abs().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Mr. Guranna Gouda are available @ **[GitHub](https://github.com/Gurupatil0003)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `abs()`\n", 17 | "\n", 18 | "The **`abs()`** method returns the absolute value of the given number. If the number is a complex number, **`abs()`** returns its magnitude.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "abs(num)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `abs()` Parameters\n", 32 | "\n", 33 | "**`abs()`** method takes a single argument:\n", 34 | "\n", 35 | "* **num** - a number whose absolute value is to be returned. The number can be:\n", 36 | " * integer\n", 37 | " * floating number\n", 38 | " * complex number" 39 | ] 40 | }, 41 | { 42 | "cell_type": "markdown", 43 | "metadata": {}, 44 | "source": [ 45 | "## Return value from `abs()`\n", 46 | "\n", 47 | "**`abs()`** method returns the absolute value of the given number.\n", 48 | "\n", 49 | "* For integers - integer absolute value is returned\n", 50 | "* For floating numbers - floating absolute value is returned\n", 51 | "* For complex numbers - magnitude of the number is returned\n" 52 | ] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "execution_count": 1, 57 | "metadata": { 58 | "ExecuteTime": { 59 | "end_time": "2021-06-14T09:47:23.660541Z", 60 | "start_time": "2021-06-14T09:47:23.641014Z" 61 | } 62 | }, 63 | "outputs": [ 64 | { 65 | "name": "stdout", 66 | "output_type": "stream", 67 | "text": [ 68 | "Absolute value of -20 is: 20\n", 69 | "Absolute value of -30.33 is: 30.33\n" 70 | ] 71 | } 72 | ], 73 | "source": [ 74 | "# Example 1: Get absolute value of a number\n", 75 | "\n", 76 | "# random integer\n", 77 | "integer = -20\n", 78 | "print('Absolute value of -20 is:', abs(integer))\n", 79 | "\n", 80 | "#random floating number\n", 81 | "floating = -30.33\n", 82 | "print('Absolute value of -30.33 is:', abs(floating))" 83 | ] 84 | }, 85 | { 86 | "cell_type": "code", 87 | "execution_count": 2, 88 | "metadata": { 89 | "ExecuteTime": { 90 | "end_time": "2021-06-14T09:47:24.842178Z", 91 | "start_time": "2021-06-14T09:47:24.814835Z" 92 | } 93 | }, 94 | "outputs": [ 95 | { 96 | "name": "stdout", 97 | "output_type": "stream", 98 | "text": [ 99 | "Magnitude of 3 - 4j is: 5.0\n" 100 | ] 101 | } 102 | ], 103 | "source": [ 104 | "# Example 2: Get magnitude of a complex number\n", 105 | "\n", 106 | "# random complex number\n", 107 | "complex = (3 - 4j)\n", 108 | "print('Magnitude of 3 - 4j is:', abs(complex))" 109 | ] 110 | }, 111 | { 112 | "cell_type": "code", 113 | "execution_count": null, 114 | "metadata": {}, 115 | "outputs": [], 116 | "source": [] 117 | } 118 | ], 119 | "metadata": { 120 | "hide_input": false, 121 | "kernelspec": { 122 | "display_name": "Python 3", 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.8.8" 137 | }, 138 | "toc": { 139 | "base_numbering": 1, 140 | "nav_menu": {}, 141 | "number_sections": true, 142 | "sideBar": true, 143 | "skip_h1_title": false, 144 | "title_cell": "Table of Contents", 145 | "title_sidebar": "Contents", 146 | "toc_cell": false, 147 | "toc_position": {}, 148 | "toc_section_display": true, 149 | "toc_window_display": false 150 | }, 151 | "varInspector": { 152 | "cols": { 153 | "lenName": 16, 154 | "lenType": 16, 155 | "lenVar": 40 156 | }, 157 | "kernels_config": { 158 | "python": { 159 | "delete_cmd_postfix": "", 160 | "delete_cmd_prefix": "del ", 161 | "library": "var_list.py", 162 | "varRefreshCmd": "print(var_dic_list())" 163 | }, 164 | "r": { 165 | "delete_cmd_postfix": ") ", 166 | "delete_cmd_prefix": "rm(", 167 | "library": "var_list.r", 168 | "varRefreshCmd": "cat(var_dic_list()) " 169 | } 170 | }, 171 | "types_to_exclude": [ 172 | "module", 173 | "function", 174 | "builtin_function_or_method", 175 | "instance", 176 | "_Feature" 177 | ], 178 | "window_display": false 179 | } 180 | }, 181 | "nbformat": 4, 182 | "nbformat_minor": 2 183 | } 184 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/004_Python_ascii().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Mr. Guranna Gouda are available @ **[GitHub](https://github.com/Gurupatil0003)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `ascii()`\n", 17 | "\n", 18 | "The **`ascii()`** method returns a string containing a printable representation of an object. It escapes the non-ASCII characters in the string using **`\\x`**, **`\\u`** or **`\\U`** escapes.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "ascii(object)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `ascii()` Parameters\n", 32 | "\n", 33 | "**`ascii()`** method takes an object (like: **[strings](https://github.com/milaan9/02_Python_Datatypes/blob/main/002_Python_String.ipynb)**, **[list](https://github.com/milaan9/02_Python_Datatypes/blob/main/003_Python_List.ipynb)** etc)." 34 | ] 35 | }, 36 | { 37 | "cell_type": "markdown", 38 | "metadata": {}, 39 | "source": [ 40 | "## Return Value from `ascii()`\n", 41 | "\n", 42 | "It returns a string containing a printable representation of an object.\n", 43 | "\n", 44 | "For example, **`ö`** is changed to **`\\xf6n`**, **`√`** is changed to **`\\u221a`**\n", 45 | "\n", 46 | "The non-ASCII characters in the string are escaped using **`\\x`**, **`\\u`** or **`\\U`**." 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 1, 52 | "metadata": { 53 | "ExecuteTime": { 54 | "end_time": "2021-06-14T09:48:52.748941Z", 55 | "start_time": "2021-06-14T09:48:52.740153Z" 56 | } 57 | }, 58 | "outputs": [ 59 | { 60 | "name": "stdout", 61 | "output_type": "stream", 62 | "text": [ 63 | "'Python is interesting'\n", 64 | "'Pyth\\xf6n is interesting'\n", 65 | "Pythön is interesting\n" 66 | ] 67 | } 68 | ], 69 | "source": [ 70 | "# Example 1: How ascii() method works?\n", 71 | "\n", 72 | "normalText = 'Python is interesting'\n", 73 | "print(ascii(normalText))\n", 74 | "\n", 75 | "otherText = 'Pythön is interesting'\n", 76 | "print(ascii(otherText))\n", 77 | "\n", 78 | "print('Pyth\\xf6n is interesting')" 79 | ] 80 | }, 81 | { 82 | "cell_type": "code", 83 | "execution_count": 2, 84 | "metadata": { 85 | "ExecuteTime": { 86 | "end_time": "2021-06-14T09:48:54.134184Z", 87 | "start_time": "2021-06-14T09:48:54.114658Z" 88 | } 89 | }, 90 | "outputs": [ 91 | { 92 | "name": "stdout", 93 | "output_type": "stream", 94 | "text": [ 95 | "['Python', 'Pyth\\xf6n', 5]\n" 96 | ] 97 | } 98 | ], 99 | "source": [ 100 | "# Example 2: randomList\n", 101 | "\n", 102 | "randomList = ['Python', 'Pythön', 5]\n", 103 | "print(ascii(randomList))" 104 | ] 105 | }, 106 | { 107 | "cell_type": "code", 108 | "execution_count": null, 109 | "metadata": {}, 110 | "outputs": [], 111 | "source": [] 112 | } 113 | ], 114 | "metadata": { 115 | "hide_input": false, 116 | "kernelspec": { 117 | "display_name": "Python 3", 118 | "language": "python", 119 | "name": "python3" 120 | }, 121 | "language_info": { 122 | "codemirror_mode": { 123 | "name": "ipython", 124 | "version": 3 125 | }, 126 | "file_extension": ".py", 127 | "mimetype": "text/x-python", 128 | "name": "python", 129 | "nbconvert_exporter": "python", 130 | "pygments_lexer": "ipython3", 131 | "version": "3.8.8" 132 | }, 133 | "toc": { 134 | "base_numbering": 1, 135 | "nav_menu": {}, 136 | "number_sections": true, 137 | "sideBar": true, 138 | "skip_h1_title": false, 139 | "title_cell": "Table of Contents", 140 | "title_sidebar": "Contents", 141 | "toc_cell": false, 142 | "toc_position": {}, 143 | "toc_section_display": true, 144 | "toc_window_display": false 145 | }, 146 | "varInspector": { 147 | "cols": { 148 | "lenName": 16, 149 | "lenType": 16, 150 | "lenVar": 40 151 | }, 152 | "kernels_config": { 153 | "python": { 154 | "delete_cmd_postfix": "", 155 | "delete_cmd_prefix": "del ", 156 | "library": "var_list.py", 157 | "varRefreshCmd": "print(var_dic_list())" 158 | }, 159 | "r": { 160 | "delete_cmd_postfix": ") ", 161 | "delete_cmd_prefix": "rm(", 162 | "library": "var_list.r", 163 | "varRefreshCmd": "cat(var_dic_list()) " 164 | } 165 | }, 166 | "types_to_exclude": [ 167 | "module", 168 | "function", 169 | "builtin_function_or_method", 170 | "instance", 171 | "_Feature" 172 | ], 173 | "window_display": false 174 | } 175 | }, 176 | "nbformat": 4, 177 | "nbformat_minor": 2 178 | } 179 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/005_Python_bin().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in **Python Functions** lecture series by Dr. Guranna Gouda are available @ **[GitHub](https://github.com/Gurupatil0003)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `bin()`\n", 17 | "\n", 18 | "The **`bin()`** method converts and returns the binary equivalent string of a given integer. If the parameter isn't an integer, it has to implement **`__index__()`** method to return an integer.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "bin(num)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `bin()` Parameters\n", 32 | "\n", 33 | "**`bin()`** method takes a single parameter:\n", 34 | "\n", 35 | "* **num** - an integer number whose binary equivalent is to be calculated.\n", 36 | "If not an integer, should implement **`__index__()`** method to return an integer." 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "## Return Value from `bin()`\n", 44 | "\n", 45 | "**`bin()`** method returns the binary string equivalent to the given integer.\n", 46 | "\n", 47 | "If not specified an integer, it raises a **`TypeError`** exception highlighting the type cannot be interpreted as an integer." 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": 1, 53 | "metadata": { 54 | "ExecuteTime": { 55 | "end_time": "2021-06-14T09:49:09.967604Z", 56 | "start_time": "2021-06-14T09:49:09.956865Z" 57 | } 58 | }, 59 | "outputs": [ 60 | { 61 | "name": "stdout", 62 | "output_type": "stream", 63 | "text": [ 64 | "The binary equivalent of 5 is: 0b101\n" 65 | ] 66 | } 67 | ], 68 | "source": [ 69 | "# Example 1: Convert integer to binary using bin()\n", 70 | "number = 5\n", 71 | "print('The binary equivalent of 5 is:', bin(number))" 72 | ] 73 | }, 74 | { 75 | "cell_type": "markdown", 76 | "metadata": {}, 77 | "source": [ 78 | "The prefix **`0b`** represents that the result is a binary string." 79 | ] 80 | }, 81 | { 82 | "cell_type": "code", 83 | "execution_count": 2, 84 | "metadata": { 85 | "ExecuteTime": { 86 | "end_time": "2021-06-14T09:49:11.596504Z", 87 | "start_time": "2021-06-14T09:49:11.586738Z" 88 | } 89 | }, 90 | "outputs": [ 91 | { 92 | "name": "stdout", 93 | "output_type": "stream", 94 | "text": [ 95 | "The binary equivalent of quantity is: 0b101\n" 96 | ] 97 | } 98 | ], 99 | "source": [ 100 | "# Example 2: Convert an object to binary implementing __index__() method\n", 101 | "\n", 102 | "class Quantity:\n", 103 | " apple = 1\n", 104 | " orange = 2\n", 105 | " grapes = 2\n", 106 | " \n", 107 | " def __index__(self):\n", 108 | " return self.apple + self.orange + self.grapes\n", 109 | " \n", 110 | "print('The binary equivalent of quantity is:', bin(Quantity()))" 111 | ] 112 | }, 113 | { 114 | "cell_type": "markdown", 115 | "metadata": {}, 116 | "source": [ 117 | "**Explanation**:\n", 118 | "\n", 119 | "Here, we've sent an object of class **`Quantity`** to the **`bin()`** method.\n", 120 | "\n", 121 | "**`bin()`** method doesn't raise an error even if the object Quantity is not an integer.\n", 122 | "\n", 123 | "This is because we have implemented the **`__index__()`** method which returns an integer (sum of fruit quantities). This integer is then supplied to the **`bin()`** method." 124 | ] 125 | }, 126 | { 127 | "cell_type": "code", 128 | "execution_count": null, 129 | "metadata": {}, 130 | "outputs": [], 131 | "source": [] 132 | } 133 | ], 134 | "metadata": { 135 | "hide_input": false, 136 | "kernelspec": { 137 | "display_name": "Python 3", 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.8.8" 152 | }, 153 | "toc": { 154 | "base_numbering": 1, 155 | "nav_menu": {}, 156 | "number_sections": true, 157 | "sideBar": true, 158 | "skip_h1_title": false, 159 | "title_cell": "Table of Contents", 160 | "title_sidebar": "Contents", 161 | "toc_cell": false, 162 | "toc_position": {}, 163 | "toc_section_display": true, 164 | "toc_window_display": false 165 | }, 166 | "varInspector": { 167 | "cols": { 168 | "lenName": 16, 169 | "lenType": 16, 170 | "lenVar": 40 171 | }, 172 | "kernels_config": { 173 | "python": { 174 | "delete_cmd_postfix": "", 175 | "delete_cmd_prefix": "del ", 176 | "library": "var_list.py", 177 | "varRefreshCmd": "print(var_dic_list())" 178 | }, 179 | "r": { 180 | "delete_cmd_postfix": ") ", 181 | "delete_cmd_prefix": "rm(", 182 | "library": "var_list.r", 183 | "varRefreshCmd": "cat(var_dic_list()) " 184 | } 185 | }, 186 | "types_to_exclude": [ 187 | "module", 188 | "function", 189 | "builtin_function_or_method", 190 | "instance", 191 | "_Feature" 192 | ], 193 | "window_display": false 194 | } 195 | }, 196 | "nbformat": 4, 197 | "nbformat_minor": 2 198 | } 199 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/006_Python_bool().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Mr. Guranna Gouda are available @ **[GitHub](https://github.com/Gurupatil0003)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `bool()`\n", 17 | "\n", 18 | "The **`bool()`** method converts a value to Boolean (**`True`** or **`False`**) using the standard truth testing procedure.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "bool([value])\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `bool()` Parameters\n", 32 | "\n", 33 | "It's not mandatory to pass a value to **`bool()`**. If you do not pass a value, **`bool()`** returns **`False`**.\n", 34 | "\n", 35 | "In general use, **`bool()`** takes a single parameter value." 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "## Return Value from `bool()`\n", 43 | "\n", 44 | "**`bool()`** returns:\n", 45 | "\n", 46 | "* **`False`** if the **`value`** is omitted or false\n", 47 | "* **`True`** if the **`value`** is true" 48 | ] 49 | }, 50 | { 51 | "cell_type": "markdown", 52 | "metadata": {}, 53 | "source": [ 54 | "## The following values are considered false in Python:\n", 55 | "\n", 56 | "* **`None`**\n", 57 | "* **`False`**\n", 58 | "* Zero of any numeric type. For example, **`0`**, **`0.0`**, **`0j`**\n", 59 | "* Empty sequence. For example, **`()`**, **`[]`**, **`''`**.\n", 60 | "* Empty mapping. For example, **`{}`**\n", 61 | "* objects of Classes which has **`__bool__()`** or **`__len()__`** method which returns **`0`** or **`False`**\n", 62 | "\n", 63 | "All other values except these values are considered true." 64 | ] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": 1, 69 | "metadata": { 70 | "ExecuteTime": { 71 | "end_time": "2021-06-14T09:50:22.987749Z", 72 | "start_time": "2021-06-14T09:50:22.949666Z" 73 | } 74 | }, 75 | "outputs": [ 76 | { 77 | "name": "stdout", 78 | "output_type": "stream", 79 | "text": [ 80 | "[] is False\n", 81 | "[0] is True\n", 82 | "0.0 is False\n", 83 | "None is False\n", 84 | "True is True\n", 85 | "Easy string is True\n" 86 | ] 87 | } 88 | ], 89 | "source": [ 90 | "# Example 1: How bool() works?\n", 91 | "\n", 92 | "test = []\n", 93 | "print(test,'is',bool(test))\n", 94 | "\n", 95 | "test = [0]\n", 96 | "print(test,'is',bool(test))\n", 97 | "\n", 98 | "test = 0.0\n", 99 | "print(test,'is',bool(test))\n", 100 | "\n", 101 | "test = None\n", 102 | "print(test,'is',bool(test))\n", 103 | "\n", 104 | "test = True\n", 105 | "print(test,'is',bool(test))\n", 106 | "\n", 107 | "test = 'Easy string'\n", 108 | "print(test,'is',bool(test))" 109 | ] 110 | }, 111 | { 112 | "cell_type": "code", 113 | "execution_count": null, 114 | "metadata": {}, 115 | "outputs": [], 116 | "source": [] 117 | } 118 | ], 119 | "metadata": { 120 | "hide_input": false, 121 | "kernelspec": { 122 | "display_name": "Python 3", 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.8.8" 137 | }, 138 | "toc": { 139 | "base_numbering": 1, 140 | "nav_menu": {}, 141 | "number_sections": true, 142 | "sideBar": true, 143 | "skip_h1_title": false, 144 | "title_cell": "Table of Contents", 145 | "title_sidebar": "Contents", 146 | "toc_cell": false, 147 | "toc_position": {}, 148 | "toc_section_display": true, 149 | "toc_window_display": false 150 | }, 151 | "varInspector": { 152 | "cols": { 153 | "lenName": 16, 154 | "lenType": 16, 155 | "lenVar": 40 156 | }, 157 | "kernels_config": { 158 | "python": { 159 | "delete_cmd_postfix": "", 160 | "delete_cmd_prefix": "del ", 161 | "library": "var_list.py", 162 | "varRefreshCmd": "print(var_dic_list())" 163 | }, 164 | "r": { 165 | "delete_cmd_postfix": ") ", 166 | "delete_cmd_prefix": "rm(", 167 | "library": "var_list.r", 168 | "varRefreshCmd": "cat(var_dic_list()) " 169 | } 170 | }, 171 | "types_to_exclude": [ 172 | "module", 173 | "function", 174 | "builtin_function_or_method", 175 | "instance", 176 | "_Feature" 177 | ], 178 | "window_display": false 179 | } 180 | }, 181 | "nbformat": 4, 182 | "nbformat_minor": 2 183 | } 184 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/011_Python_compile().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Mr. Guranna Gouda are available @ **[GitHub](https://github.com/Gurupatil0003)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `compile()`\n", 17 | "\n", 18 | "The **`compile()`** method returns a Python code object from the source (normal string, a byte string, or an AST object).\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)\n", 24 | "```\n", 25 | "\n", 26 | "**`compile()`** method is used if the Python code is in string form or is an AST object, and you want to change it to a code object.\n", 27 | "\n", 28 | "The code object returned by **`compile()`** method can later be called using methods like: **[exec()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/027_Python_exec%28%29.ipynb)** and **[eval()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/021_Python_eval%28%29.ipynb)** which will execute dynamically generated Python code." 29 | ] 30 | }, 31 | { 32 | "cell_type": "markdown", 33 | "metadata": {}, 34 | "source": [ 35 | "## `compile()` Parameters\n", 36 | "\n", 37 | "* **`source`** - a normal string, a byte string, or an AST object\n", 38 | "* **`filename`** - file from which the code was read. If it wasn't read from a file, you can give a name yourself\n", 39 | "* **`mode`** - Either **`eval`** or **`exec`** or **`single`**.\n", 40 | " * **`eval`** - accepts only a single expression.\n", 41 | " * **`exec`** - It can take a code block that has Python statements, class and functions, and so on.\n", 42 | " * **`single`** - if it consists of a single interactive statement\n", 43 | "* **`flags`** (optional) and **`dont_inherit`** (optional) - controls which future statements affect the * compilation of the source. Default Value: 0\n", 44 | "* **`optimize`** (optional) - optimization level of the compiler. Default value -1." 45 | ] 46 | }, 47 | { 48 | "cell_type": "markdown", 49 | "metadata": {}, 50 | "source": [ 51 | "## Return Value from `compile()`\n", 52 | "\n", 53 | "**`compile()`** method returns a Python code object." 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": 1, 59 | "metadata": { 60 | "ExecuteTime": { 61 | "end_time": "2021-06-14T09:53:17.996156Z", 62 | "start_time": "2021-06-14T09:53:17.979071Z" 63 | } 64 | }, 65 | "outputs": [ 66 | { 67 | "name": "stdout", 68 | "output_type": "stream", 69 | "text": [ 70 | "sum = 11\n" 71 | ] 72 | } 73 | ], 74 | "source": [ 75 | "# Example 1: How compile() works?\n", 76 | "\n", 77 | "codeInString = 'a = 5\\nb=6\\nsum=a+b\\nprint(\"sum =\",sum)'\n", 78 | "codeObejct = compile(codeInString, 'sumstring', 'exec')\n", 79 | "\n", 80 | "exec(codeObejct)" 81 | ] 82 | }, 83 | { 84 | "cell_type": "markdown", 85 | "metadata": {}, 86 | "source": [ 87 | "**Explanation**:\n", 88 | "\n", 89 | "Here, **`source`** is in normal string form. The **`filename`** is sumstring. And, the **`exec`** mode later allows the use of **`exec()`** method.\n", 90 | "\n", 91 | "**`compile()`** method converts the string to Python code object. The code object is then executed using **`exec()`** method." 92 | ] 93 | }, 94 | { 95 | "cell_type": "code", 96 | "execution_count": null, 97 | "metadata": {}, 98 | "outputs": [], 99 | "source": [] 100 | } 101 | ], 102 | "metadata": { 103 | "hide_input": false, 104 | "kernelspec": { 105 | "display_name": "Python 3", 106 | "language": "python", 107 | "name": "python3" 108 | }, 109 | "language_info": { 110 | "codemirror_mode": { 111 | "name": "ipython", 112 | "version": 3 113 | }, 114 | "file_extension": ".py", 115 | "mimetype": "text/x-python", 116 | "name": "python", 117 | "nbconvert_exporter": "python", 118 | "pygments_lexer": "ipython3", 119 | "version": "3.8.8" 120 | }, 121 | "toc": { 122 | "base_numbering": 1, 123 | "nav_menu": {}, 124 | "number_sections": true, 125 | "sideBar": true, 126 | "skip_h1_title": false, 127 | "title_cell": "Table of Contents", 128 | "title_sidebar": "Contents", 129 | "toc_cell": false, 130 | "toc_position": {}, 131 | "toc_section_display": true, 132 | "toc_window_display": false 133 | }, 134 | "varInspector": { 135 | "cols": { 136 | "lenName": 16, 137 | "lenType": 16, 138 | "lenVar": 40 139 | }, 140 | "kernels_config": { 141 | "python": { 142 | "delete_cmd_postfix": "", 143 | "delete_cmd_prefix": "del ", 144 | "library": "var_list.py", 145 | "varRefreshCmd": "print(var_dic_list())" 146 | }, 147 | "r": { 148 | "delete_cmd_postfix": ") ", 149 | "delete_cmd_prefix": "rm(", 150 | "library": "var_list.r", 151 | "varRefreshCmd": "cat(var_dic_list()) " 152 | } 153 | }, 154 | "types_to_exclude": [ 155 | "module", 156 | "function", 157 | "builtin_function_or_method", 158 | "instance", 159 | "_Feature" 160 | ], 161 | "window_display": false 162 | } 163 | }, 164 | "nbformat": 4, 165 | "nbformat_minor": 2 166 | } 167 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/013_Python_complex().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Mr.Guranna Gouda are available @ **[GitHub](https://github.com/Gurupatil0003)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `complex()`\n", 17 | "\n", 18 | "The **`complex()`** method returns a complex number when real and imaginary parts are provided, or it converts a string to a complex number.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "complex([real[, imag]])\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `complex()` Parameters\n", 32 | "\n", 33 | "In general, **`complex()`** method takes two parameters:\n", 34 | "\n", 35 | "* **real** - real part. If **`real`** is omitted, it defaults to 0.\n", 36 | "* **imag** - imaginary part. If **`imag`** is omitted, it defaults to 0.\n", 37 | "\n", 38 | "If the first parameter passed to this method is a string, it will be interpreted as a complex number. In this case, the second parameter shouldn't be passed." 39 | ] 40 | }, 41 | { 42 | "cell_type": "markdown", 43 | "metadata": {}, 44 | "source": [ 45 | "## Return Value from `complex()`\n", 46 | "\n", 47 | "As suggested by the name, **`complex()`** method returns a complex number.\n", 48 | "\n", 49 | "If the string passed to this method is not a valid complex number, **`ValueError`** exception is raised.\n", 50 | "\n", 51 | "> **Note**: The string passed to **`complex()`** should be in the form **`real+imagj`** or **`real+imagJ`**" 52 | ] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "execution_count": 1, 57 | "metadata": { 58 | "ExecuteTime": { 59 | "end_time": "2021-06-14T09:54:03.825035Z", 60 | "start_time": "2021-06-14T09:54:03.797696Z" 61 | } 62 | }, 63 | "outputs": [ 64 | { 65 | "name": "stdout", 66 | "output_type": "stream", 67 | "text": [ 68 | "(2-3j)\n", 69 | "(1+0j)\n", 70 | "0j\n", 71 | "(5-9j)\n" 72 | ] 73 | } 74 | ], 75 | "source": [ 76 | "# Example 1: How to create a complex number in Python?\n", 77 | "\n", 78 | "z = complex(2, -3)\n", 79 | "print(z)\n", 80 | "\n", 81 | "z = complex(1)\n", 82 | "print(z)\n", 83 | "\n", 84 | "z = complex()\n", 85 | "print(z)\n", 86 | "\n", 87 | "z = complex('5-9j')\n", 88 | "print(z)" 89 | ] 90 | }, 91 | { 92 | "cell_type": "code", 93 | "execution_count": 2, 94 | "metadata": { 95 | "ExecuteTime": { 96 | "end_time": "2021-06-14T09:54:04.750813Z", 97 | "start_time": "2021-06-14T09:54:04.741049Z" 98 | } 99 | }, 100 | "outputs": [ 101 | { 102 | "name": "stdout", 103 | "output_type": "stream", 104 | "text": [ 105 | "a = (2+3j)\n", 106 | "Type of a is \n", 107 | "b = (-0-2j)\n", 108 | "Type of b is \n", 109 | "c = 0j\n", 110 | "Type of c is \n" 111 | ] 112 | } 113 | ], 114 | "source": [ 115 | "# Example 2: Create complex Number Without Using complex()\n", 116 | "\n", 117 | "# It's possible to create a complex number without using `complex()` method. \n", 118 | "# For that, you have to put 'j' or 'J' after a number.\n", 119 | "\n", 120 | "a = 2+3j\n", 121 | "print('a =',a)\n", 122 | "print('Type of a is',type(a))\n", 123 | "\n", 124 | "b = -2j\n", 125 | "print('b =',b)\n", 126 | "print('Type of b is',type(a))\n", 127 | "\n", 128 | "c = 0j\n", 129 | "print('c =',c)\n", 130 | "print('Type of c is',type(c))" 131 | ] 132 | }, 133 | { 134 | "cell_type": "code", 135 | "execution_count": null, 136 | "metadata": {}, 137 | "outputs": [], 138 | "source": [] 139 | } 140 | ], 141 | "metadata": { 142 | "hide_input": false, 143 | "kernelspec": { 144 | "display_name": "Python 3", 145 | "language": "python", 146 | "name": "python3" 147 | }, 148 | "language_info": { 149 | "codemirror_mode": { 150 | "name": "ipython", 151 | "version": 3 152 | }, 153 | "file_extension": ".py", 154 | "mimetype": "text/x-python", 155 | "name": "python", 156 | "nbconvert_exporter": "python", 157 | "pygments_lexer": "ipython3", 158 | "version": "3.8.8" 159 | }, 160 | "toc": { 161 | "base_numbering": 1, 162 | "nav_menu": {}, 163 | "number_sections": true, 164 | "sideBar": true, 165 | "skip_h1_title": false, 166 | "title_cell": "Table of Contents", 167 | "title_sidebar": "Contents", 168 | "toc_cell": false, 169 | "toc_position": {}, 170 | "toc_section_display": true, 171 | "toc_window_display": false 172 | }, 173 | "varInspector": { 174 | "cols": { 175 | "lenName": 16, 176 | "lenType": 16, 177 | "lenVar": 40 178 | }, 179 | "kernels_config": { 180 | "python": { 181 | "delete_cmd_postfix": "", 182 | "delete_cmd_prefix": "del ", 183 | "library": "var_list.py", 184 | "varRefreshCmd": "print(var_dic_list())" 185 | }, 186 | "r": { 187 | "delete_cmd_postfix": ") ", 188 | "delete_cmd_prefix": "rm(", 189 | "library": "var_list.r", 190 | "varRefreshCmd": "cat(var_dic_list()) " 191 | } 192 | }, 193 | "types_to_exclude": [ 194 | "module", 195 | "function", 196 | "builtin_function_or_method", 197 | "instance", 198 | "_Feature" 199 | ], 200 | "window_display": false 201 | } 202 | }, 203 | "nbformat": 4, 204 | "nbformat_minor": 2 205 | } 206 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/017_Python_divmod().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `divmod()`\n", 17 | "\n", 18 | "The **`divmod()`** method takes two numbers and returns a pair of numbers (a tuple) consisting of their quotient and remainder.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "divmod(x, y)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `divmod()` Parameters\n", 32 | "\n", 33 | "**`divmod()`** takes two parameters:\n", 34 | "\n", 35 | "* **x** - a non-complex number (numerator)\n", 36 | "* **y** - a non-complex number (denominator)" 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "## Return Value from `divmod()`\n", 44 | "\n", 45 | "**`divmod()`** returns\n", 46 | "\n", 47 | "* **`(q, r)`** - a pair of numbers (a **[tuple](https://github.com/milaan9/02_Python_Datatypes/blob/main/004_Python_Tuple.ipynb)**) consisting of quotient **`q`** and remainder **`r`**\n", 48 | "\n", 49 | "If **`x`** and **`y`** are integers, the return value from **`divmod()`** is same as **`(a // b, x % y)`**.\n", 50 | "\n", 51 | "If either **`x`** or **`y`** is a float, the result is **`(q, x%y)`**. Here, **`q`** is the whole part of the quotient." 52 | ] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "execution_count": 1, 57 | "metadata": { 58 | "ExecuteTime": { 59 | "end_time": "2021-06-14T09:55:27.312423Z", 60 | "start_time": "2021-06-14T09:55:27.264575Z" 61 | }, 62 | "scrolled": true 63 | }, 64 | "outputs": [ 65 | { 66 | "name": "stdout", 67 | "output_type": "stream", 68 | "text": [ 69 | "divmod(8, 3) = (2, 2)\n", 70 | "divmod(3, 8) = (0, 3)\n", 71 | "divmod(5, 5) = (1, 0)\n", 72 | "divmod(8.0, 3) = (2.0, 2.0)\n", 73 | "divmod(3, 8.0) = (0.0, 3.0)\n", 74 | "divmod(7.5, 2.5) = (3.0, 0.0)\n", 75 | "divmod(2.6, 0.5) = (5.0, 0.10000000000000009)\n" 76 | ] 77 | } 78 | ], 79 | "source": [ 80 | "# Example 1: How divmod() works in Python?\n", 81 | "\n", 82 | "print('divmod(8, 3) = ', divmod(8, 3))\n", 83 | "print('divmod(3, 8) = ', divmod(3, 8))\n", 84 | "print('divmod(5, 5) = ', divmod(5, 5))\n", 85 | "\n", 86 | "# divmod() with Floats\n", 87 | "print('divmod(8.0, 3) = ', divmod(8.0, 3))\n", 88 | "print('divmod(3, 8.0) = ', divmod(3, 8.0))\n", 89 | "print('divmod(7.5, 2.5) = ', divmod(7.5, 2.5))\n", 90 | "print('divmod(2.6, 0.5) = ', divmod(2.6, 0.5))" 91 | ] 92 | }, 93 | { 94 | "cell_type": "code", 95 | "execution_count": null, 96 | "metadata": {}, 97 | "outputs": [], 98 | "source": [] 99 | } 100 | ], 101 | "metadata": { 102 | "hide_input": false, 103 | "kernelspec": { 104 | "display_name": "Python 3", 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.8.8" 119 | }, 120 | "toc": { 121 | "base_numbering": 1, 122 | "nav_menu": {}, 123 | "number_sections": true, 124 | "sideBar": true, 125 | "skip_h1_title": false, 126 | "title_cell": "Table of Contents", 127 | "title_sidebar": "Contents", 128 | "toc_cell": false, 129 | "toc_position": {}, 130 | "toc_section_display": true, 131 | "toc_window_display": false 132 | }, 133 | "varInspector": { 134 | "cols": { 135 | "lenName": 16, 136 | "lenType": 16, 137 | "lenVar": 40 138 | }, 139 | "kernels_config": { 140 | "python": { 141 | "delete_cmd_postfix": "", 142 | "delete_cmd_prefix": "del ", 143 | "library": "var_list.py", 144 | "varRefreshCmd": "print(var_dic_list())" 145 | }, 146 | "r": { 147 | "delete_cmd_postfix": ") ", 148 | "delete_cmd_prefix": "rm(", 149 | "library": "var_list.r", 150 | "varRefreshCmd": "cat(var_dic_list()) " 151 | } 152 | }, 153 | "types_to_exclude": [ 154 | "module", 155 | "function", 156 | "builtin_function_or_method", 157 | "instance", 158 | "_Feature" 159 | ], 160 | "window_display": false 161 | } 162 | }, 163 | "nbformat": 4, 164 | "nbformat_minor": 2 165 | } 166 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/018_Python_enumerate().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `enumerate()`\n", 17 | "\n", 18 | "The **`enumerate()`** method adds counter to an iterable and returns it (the enumerate object).\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "enumerate(iterable, start=0)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `enumerate()` Parameters\n", 32 | "\n", 33 | "**`enumerate()`** takes two parameters:\n", 34 | "\n", 35 | "* **iterable** - a sequence, an iterator, or objects that supports iteration\n", 36 | "* **start** (optional) - **`enumerate()`** starts counting from this number. If **`start`** is omitted, **`0`** is taken as **`start`**." 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "## Return Value from `enumerate()`\n", 44 | "\n", 45 | "**`enumerate()`** method adds counter to an iterable and returns it. The returned object is a enumerate object.\n", 46 | "\n", 47 | "You can convert enumerate objects to list and tuple using **[list()](https://github.com/milaan9/02_Python_Datatypes/blob/main/003_Python_List.ipynb)** and **[tuple()](https://github.com/milaan9/02_Python_Datatypes/blob/main/004_Python_Tuple.ipynb)** method respectively." 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": 1, 53 | "metadata": { 54 | "ExecuteTime": { 55 | "end_time": "2021-06-14T09:55:44.728845Z", 56 | "start_time": "2021-06-14T09:55:44.712244Z" 57 | }, 58 | "scrolled": true 59 | }, 60 | "outputs": [ 61 | { 62 | "name": "stdout", 63 | "output_type": "stream", 64 | "text": [ 65 | "\n", 66 | "[(0, 'bread'), (1, 'milk'), (2, 'butter')]\n", 67 | "[(10, 'bread'), (11, 'milk'), (12, 'butter')]\n" 68 | ] 69 | } 70 | ], 71 | "source": [ 72 | "# Example 1: How enumerate() works in Python?\n", 73 | "\n", 74 | "grocery = ['bread', 'milk', 'butter']\n", 75 | "enumerateGrocery = enumerate(grocery)\n", 76 | "\n", 77 | "print(type(enumerateGrocery))\n", 78 | "\n", 79 | "# converting to list\n", 80 | "print(list(enumerateGrocery))\n", 81 | "\n", 82 | "# changing the default counter\n", 83 | "enumerateGrocery = enumerate(grocery, 10)\n", 84 | "print(list(enumerateGrocery))" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": 2, 90 | "metadata": { 91 | "ExecuteTime": { 92 | "end_time": "2021-06-14T09:55:45.555502Z", 93 | "start_time": "2021-06-14T09:55:45.536458Z" 94 | } 95 | }, 96 | "outputs": [ 97 | { 98 | "name": "stdout", 99 | "output_type": "stream", 100 | "text": [ 101 | "(0, 'bread')\n", 102 | "(1, 'milk')\n", 103 | "(2, 'butter')\n", 104 | "\n", 105 | "\n", 106 | "0 bread\n", 107 | "1 milk\n", 108 | "2 butter\n", 109 | "\n", 110 | "\n", 111 | "100 bread\n", 112 | "101 milk\n", 113 | "102 butter\n" 114 | ] 115 | } 116 | ], 117 | "source": [ 118 | "# Example 2: Looping Over an Enumerate object\n", 119 | "\n", 120 | "grocery = ['bread', 'milk', 'butter']\n", 121 | "\n", 122 | "for item in enumerate(grocery):\n", 123 | " print(item)\n", 124 | "\n", 125 | "print('\\n')\n", 126 | "for count, item in enumerate(grocery):\n", 127 | " print(count, item)\n", 128 | "\n", 129 | "print('\\n')\n", 130 | "# changing default start value\n", 131 | "for count, item in enumerate(grocery, 100):\n", 132 | " print(count, item)" 133 | ] 134 | }, 135 | { 136 | "cell_type": "code", 137 | "execution_count": null, 138 | "metadata": {}, 139 | "outputs": [], 140 | "source": [] 141 | } 142 | ], 143 | "metadata": { 144 | "hide_input": false, 145 | "kernelspec": { 146 | "display_name": "Python 3", 147 | "language": "python", 148 | "name": "python3" 149 | }, 150 | "language_info": { 151 | "codemirror_mode": { 152 | "name": "ipython", 153 | "version": 3 154 | }, 155 | "file_extension": ".py", 156 | "mimetype": "text/x-python", 157 | "name": "python", 158 | "nbconvert_exporter": "python", 159 | "pygments_lexer": "ipython3", 160 | "version": "3.8.8" 161 | }, 162 | "toc": { 163 | "base_numbering": 1, 164 | "nav_menu": {}, 165 | "number_sections": true, 166 | "sideBar": true, 167 | "skip_h1_title": false, 168 | "title_cell": "Table of Contents", 169 | "title_sidebar": "Contents", 170 | "toc_cell": false, 171 | "toc_position": {}, 172 | "toc_section_display": true, 173 | "toc_window_display": false 174 | }, 175 | "varInspector": { 176 | "cols": { 177 | "lenName": 16, 178 | "lenType": 16, 179 | "lenVar": 40 180 | }, 181 | "kernels_config": { 182 | "python": { 183 | "delete_cmd_postfix": "", 184 | "delete_cmd_prefix": "del ", 185 | "library": "var_list.py", 186 | "varRefreshCmd": "print(var_dic_list())" 187 | }, 188 | "r": { 189 | "delete_cmd_postfix": ") ", 190 | "delete_cmd_prefix": "rm(", 191 | "library": "var_list.r", 192 | "varRefreshCmd": "cat(var_dic_list()) " 193 | } 194 | }, 195 | "types_to_exclude": [ 196 | "module", 197 | "function", 198 | "builtin_function_or_method", 199 | "instance", 200 | "_Feature" 201 | ], 202 | "window_display": false 203 | } 204 | }, 205 | "nbformat": 4, 206 | "nbformat_minor": 2 207 | } 208 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/028_Python_hasattr().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `hasattr()`\n", 17 | "\n", 18 | "The **`hasattr()`** method returns true if an object has the given named attribute and false if it does not.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "hasattr(object, name)\n", 24 | "```\n", 25 | "\n", 26 | "**`hasattr()`** is called by **[getattr()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/025_Python_getattr%28%29.ipynb)** to check to see if **`AttributeError`** is to be raised or not." 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "## `hasattr()` Parameters\n", 34 | "\n", 35 | "**`hasattr()`** method takes two parameters:\n", 36 | "\n", 37 | "* **object** - object whose named attribute is to be checked\n", 38 | "* **name** - name of the attribute to be searched" 39 | ] 40 | }, 41 | { 42 | "cell_type": "markdown", 43 | "metadata": {}, 44 | "source": [ 45 | "## Return Value from `hasattr()`\n", 46 | "\n", 47 | "**`hasattr()`** method returns:\n", 48 | "\n", 49 | "* **True**, if object has the given named attribute\n", 50 | "* **False**, if object has no given named attribute" 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": 1, 56 | "metadata": { 57 | "ExecuteTime": { 58 | "end_time": "2021-06-14T10:04:41.253271Z", 59 | "start_time": "2021-06-14T10:04:41.235694Z" 60 | }, 61 | "scrolled": false 62 | }, 63 | "outputs": [ 64 | { 65 | "name": "stdout", 66 | "output_type": "stream", 67 | "text": [ 68 | "Person has age?: True\n", 69 | "Person has salary?: False\n" 70 | ] 71 | } 72 | ], 73 | "source": [ 74 | "# Example: How hasattr() works in Python?\n", 75 | "\n", 76 | "class Person:\n", 77 | " age = 23\n", 78 | " name = 'Adam'\n", 79 | "\n", 80 | "person = Person()\n", 81 | "\n", 82 | "print('Person has age?:', hasattr(person, 'age'))\n", 83 | "print('Person has salary?:', hasattr(person, 'salary'))" 84 | ] 85 | }, 86 | { 87 | "cell_type": "code", 88 | "execution_count": null, 89 | "metadata": {}, 90 | "outputs": [], 91 | "source": [] 92 | } 93 | ], 94 | "metadata": { 95 | "hide_input": false, 96 | "kernelspec": { 97 | "display_name": "Python 3", 98 | "language": "python", 99 | "name": "python3" 100 | }, 101 | "language_info": { 102 | "codemirror_mode": { 103 | "name": "ipython", 104 | "version": 3 105 | }, 106 | "file_extension": ".py", 107 | "mimetype": "text/x-python", 108 | "name": "python", 109 | "nbconvert_exporter": "python", 110 | "pygments_lexer": "ipython3", 111 | "version": "3.8.8" 112 | }, 113 | "toc": { 114 | "base_numbering": 1, 115 | "nav_menu": {}, 116 | "number_sections": true, 117 | "sideBar": true, 118 | "skip_h1_title": false, 119 | "title_cell": "Table of Contents", 120 | "title_sidebar": "Contents", 121 | "toc_cell": false, 122 | "toc_position": {}, 123 | "toc_section_display": true, 124 | "toc_window_display": false 125 | }, 126 | "varInspector": { 127 | "cols": { 128 | "lenName": 16, 129 | "lenType": 16, 130 | "lenVar": 40 131 | }, 132 | "kernels_config": { 133 | "python": { 134 | "delete_cmd_postfix": "", 135 | "delete_cmd_prefix": "del ", 136 | "library": "var_list.py", 137 | "varRefreshCmd": "print(var_dic_list())" 138 | }, 139 | "r": { 140 | "delete_cmd_postfix": ") ", 141 | "delete_cmd_prefix": "rm(", 142 | "library": "var_list.r", 143 | "varRefreshCmd": "cat(var_dic_list()) " 144 | } 145 | }, 146 | "types_to_exclude": [ 147 | "module", 148 | "function", 149 | "builtin_function_or_method", 150 | "instance", 151 | "_Feature" 152 | ], 153 | "window_display": false 154 | } 155 | }, 156 | "nbformat": 4, 157 | "nbformat_minor": 2 158 | } 159 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/030_Python_hex().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in **Python Functions** lecture series by Dr. Guranna Gouda are available @ **[GitHub](https://github.com/Gurupatil0003)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `hex()`\n", 17 | "\n", 18 | "The **`hex()`** function converts an integer number to the corresponding hexadecimal string.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "hex(x)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `hex()` Parameters\n", 32 | "\n", 33 | "**`hex()`** function takes a single argument.\n", 34 | "\n", 35 | "* **x** - integer number (int object or it has to define **`__index__()`** method that returns an integer)" 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "## Return Value from `hex()`\n", 43 | "\n", 44 | "**`hex()`** function converts an integer to the corresponding hexadecimal number in string form and returns it.\n", 45 | "\n", 46 | "The returned hexadecimal string starts with the prefix **`0x`** indicating it's in hexadecimal form." 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 1, 52 | "metadata": { 53 | "ExecuteTime": { 54 | "end_time": "2021-06-14T10:05:41.052342Z", 55 | "start_time": "2021-06-14T10:05:41.037694Z" 56 | }, 57 | "scrolled": false 58 | }, 59 | "outputs": [ 60 | { 61 | "name": "stdout", 62 | "output_type": "stream", 63 | "text": [ 64 | "435 in hex = 0x1b3\n", 65 | "0 in hex = 0x0\n", 66 | "-34 in hex = -0x22\n", 67 | "Return type from hex() is \n" 68 | ] 69 | } 70 | ], 71 | "source": [ 72 | "# Example 1: How hex() works?\n", 73 | "\n", 74 | "number = 435\n", 75 | "print(number, 'in hex =', hex(number))\n", 76 | "\n", 77 | "number = 0\n", 78 | "print(number, 'in hex =', hex(number))\n", 79 | "\n", 80 | "number = -34\n", 81 | "print(number, 'in hex =', hex(number))\n", 82 | "\n", 83 | "returnType = type(hex(number))\n", 84 | "print('Return type from hex() is', returnType)" 85 | ] 86 | }, 87 | { 88 | "cell_type": "markdown", 89 | "metadata": {}, 90 | "source": [ 91 | "If you need to find a hexadecimal representation of a float, you need to use **`float.hex()`** method." 92 | ] 93 | }, 94 | { 95 | "cell_type": "code", 96 | "execution_count": 2, 97 | "metadata": { 98 | "ExecuteTime": { 99 | "end_time": "2021-06-14T10:05:42.514738Z", 100 | "start_time": "2021-06-14T10:05:42.485442Z" 101 | } 102 | }, 103 | "outputs": [ 104 | { 105 | "name": "stdout", 106 | "output_type": "stream", 107 | "text": [ 108 | "2.5 in hex = 0x1.4000000000000p+1\n", 109 | "0.0 in hex = 0x0.0p+0\n", 110 | "10.5 in hex = 0x1.5000000000000p+3\n" 111 | ] 112 | } 113 | ], 114 | "source": [ 115 | "# Example 2: Hexadecimal representation of a float\n", 116 | "\n", 117 | "number = 2.5\n", 118 | "print(number, 'in hex =', float.hex(number))\n", 119 | "\n", 120 | "number = 0.0\n", 121 | "print(number, 'in hex =', float.hex(number))\n", 122 | "\n", 123 | "number = 10.5\n", 124 | "print(number, 'in hex =', float.hex(number))" 125 | ] 126 | }, 127 | { 128 | "cell_type": "code", 129 | "execution_count": null, 130 | "metadata": {}, 131 | "outputs": [], 132 | "source": [] 133 | } 134 | ], 135 | "metadata": { 136 | "hide_input": false, 137 | "kernelspec": { 138 | "display_name": "Python 3", 139 | "language": "python", 140 | "name": "python3" 141 | }, 142 | "language_info": { 143 | "codemirror_mode": { 144 | "name": "ipython", 145 | "version": 3 146 | }, 147 | "file_extension": ".py", 148 | "mimetype": "text/x-python", 149 | "name": "python", 150 | "nbconvert_exporter": "python", 151 | "pygments_lexer": "ipython3", 152 | "version": "3.8.8" 153 | }, 154 | "toc": { 155 | "base_numbering": 1, 156 | "nav_menu": {}, 157 | "number_sections": true, 158 | "sideBar": true, 159 | "skip_h1_title": false, 160 | "title_cell": "Table of Contents", 161 | "title_sidebar": "Contents", 162 | "toc_cell": false, 163 | "toc_position": {}, 164 | "toc_section_display": true, 165 | "toc_window_display": false 166 | }, 167 | "varInspector": { 168 | "cols": { 169 | "lenName": 16, 170 | "lenType": 16, 171 | "lenVar": 40 172 | }, 173 | "kernels_config": { 174 | "python": { 175 | "delete_cmd_postfix": "", 176 | "delete_cmd_prefix": "del ", 177 | "library": "var_list.py", 178 | "varRefreshCmd": "print(var_dic_list())" 179 | }, 180 | "r": { 181 | "delete_cmd_postfix": ") ", 182 | "delete_cmd_prefix": "rm(", 183 | "library": "var_list.r", 184 | "varRefreshCmd": "cat(var_dic_list()) " 185 | } 186 | }, 187 | "types_to_exclude": [ 188 | "module", 189 | "function", 190 | "builtin_function_or_method", 191 | "instance", 192 | "_Feature" 193 | ], 194 | "window_display": false 195 | } 196 | }, 197 | "nbformat": 4, 198 | "nbformat_minor": 2 199 | } 200 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/032_Python_input().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `input()`\n", 17 | "\n", 18 | "The **`input()`** method reads a line from input, converts into a string and returns it.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "input([prompt])\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `input()` Parameters\n", 32 | "\n", 33 | "The **`input()`** method takes a single optional argument:\n", 34 | "\n", 35 | "* **prompt (Optional)** - a string that is written to standard output (usually screen) without trailing newline" 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "## Return Value from `input()`\n", 43 | "\n", 44 | "The **`input()`** method reads a line from the input (usually from the user), converts the line into a string by removing the trailing newline, and returns it.\n", 45 | "\n", 46 | "If **EOF** is read, it raises an **`EOFError`** exception." 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 1, 52 | "metadata": { 53 | "ExecuteTime": { 54 | "end_time": "2021-06-14T10:06:22.281660Z", 55 | "start_time": "2021-06-14T10:06:11.670375Z" 56 | }, 57 | "scrolled": false 58 | }, 59 | "outputs": [ 60 | { 61 | "name": "stdout", 62 | "output_type": "stream", 63 | "text": [ 64 | "Hello\n", 65 | "The inputted string is: Hello\n" 66 | ] 67 | } 68 | ], 69 | "source": [ 70 | "# Example 1: How input() works in Python?\n", 71 | "# get input from user\n", 72 | "\n", 73 | "inputString = input()\n", 74 | "\n", 75 | "print('The inputted string is:', inputString)" 76 | ] 77 | }, 78 | { 79 | "cell_type": "code", 80 | "execution_count": 2, 81 | "metadata": { 82 | "ExecuteTime": { 83 | "end_time": "2021-06-14T10:06:39.105809Z", 84 | "start_time": "2021-06-14T10:06:25.118073Z" 85 | } 86 | }, 87 | "outputs": [ 88 | { 89 | "name": "stdout", 90 | "output_type": "stream", 91 | "text": [ 92 | "Enter a string:Perfect\n", 93 | "The inputted string is: Perfect\n" 94 | ] 95 | } 96 | ], 97 | "source": [ 98 | "# Example 2: Get input from user with a prompt\n", 99 | "# get input from user\n", 100 | "\n", 101 | "inputString = input('Enter a string:')\n", 102 | "\n", 103 | "print('The inputted string is:', inputString)" 104 | ] 105 | }, 106 | { 107 | "cell_type": "code", 108 | "execution_count": null, 109 | "metadata": {}, 110 | "outputs": [], 111 | "source": [] 112 | } 113 | ], 114 | "metadata": { 115 | "hide_input": false, 116 | "kernelspec": { 117 | "display_name": "Python 3", 118 | "language": "python", 119 | "name": "python3" 120 | }, 121 | "language_info": { 122 | "codemirror_mode": { 123 | "name": "ipython", 124 | "version": 3 125 | }, 126 | "file_extension": ".py", 127 | "mimetype": "text/x-python", 128 | "name": "python", 129 | "nbconvert_exporter": "python", 130 | "pygments_lexer": "ipython3", 131 | "version": "3.8.8" 132 | }, 133 | "toc": { 134 | "base_numbering": 1, 135 | "nav_menu": {}, 136 | "number_sections": true, 137 | "sideBar": true, 138 | "skip_h1_title": false, 139 | "title_cell": "Table of Contents", 140 | "title_sidebar": "Contents", 141 | "toc_cell": false, 142 | "toc_position": {}, 143 | "toc_section_display": true, 144 | "toc_window_display": false 145 | }, 146 | "varInspector": { 147 | "cols": { 148 | "lenName": 16, 149 | "lenType": 16, 150 | "lenVar": 40 151 | }, 152 | "kernels_config": { 153 | "python": { 154 | "delete_cmd_postfix": "", 155 | "delete_cmd_prefix": "del ", 156 | "library": "var_list.py", 157 | "varRefreshCmd": "print(var_dic_list())" 158 | }, 159 | "r": { 160 | "delete_cmd_postfix": ") ", 161 | "delete_cmd_prefix": "rm(", 162 | "library": "var_list.r", 163 | "varRefreshCmd": "cat(var_dic_list()) " 164 | } 165 | }, 166 | "types_to_exclude": [ 167 | "module", 168 | "function", 169 | "builtin_function_or_method", 170 | "instance", 171 | "_Feature" 172 | ], 173 | "window_display": false 174 | } 175 | }, 176 | "nbformat": 4, 177 | "nbformat_minor": 2 178 | } 179 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/033_Python_id().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `id()`\n", 17 | "\n", 18 | "The **`id()`** function returns identity (unique integer) of an object.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "id(object)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `id()` Parameters\n", 32 | "\n", 33 | "**`id()`** function takes a single parameter **`object`**." 34 | ] 35 | }, 36 | { 37 | "cell_type": "markdown", 38 | "metadata": {}, 39 | "source": [ 40 | "## Return Value from `id()`\n", 41 | "\n", 42 | "**`id()`** unction returns the identity of the object. This is an integer that is unique for the given object and remains constant during its lifetime." 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 1, 48 | "metadata": { 49 | "ExecuteTime": { 50 | "end_time": "2021-06-14T11:17:49.863226Z", 51 | "start_time": "2021-06-14T11:17:49.846625Z" 52 | }, 53 | "scrolled": false 54 | }, 55 | "outputs": [ 56 | { 57 | "name": "stdout", 58 | "output_type": "stream", 59 | "text": [ 60 | "id of dummyFoo = 1830087123344\n" 61 | ] 62 | } 63 | ], 64 | "source": [ 65 | "# Example 1: How id() works?\n", 66 | "class Foo:\n", 67 | " b = 5\n", 68 | "\n", 69 | "dummyFoo = Foo()\n", 70 | "print('id of dummyFoo =',id(dummyFoo))" 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": 2, 76 | "metadata": { 77 | "ExecuteTime": { 78 | "end_time": "2021-06-14T11:17:50.893496Z", 79 | "start_time": "2021-06-14T11:17:50.882753Z" 80 | } 81 | }, 82 | "outputs": [ 83 | { 84 | "name": "stdout", 85 | "output_type": "stream", 86 | "text": [ 87 | "id of 5 = 140731973642160\n", 88 | "id of a = 140731973642160\n", 89 | "id of b = 140731973642160\n", 90 | "id of c = 1830086141680\n" 91 | ] 92 | } 93 | ], 94 | "source": [ 95 | "# More Examples on id()\n", 96 | "\n", 97 | "print('id of 5 =',id(5))\n", 98 | "\n", 99 | "a = 5\n", 100 | "print('id of a =',id(a))\n", 101 | "\n", 102 | "b = a\n", 103 | "print('id of b =',id(b))\n", 104 | "\n", 105 | "c = 5.0\n", 106 | "print('id of c =',id(c))" 107 | ] 108 | }, 109 | { 110 | "cell_type": "markdown", 111 | "metadata": {}, 112 | "source": [ 113 | "It's important to note that everything in Python is an object, even numbers, and Classes.\n", 114 | "\n", 115 | "Hence, integer **`5`** has a unique id. The id of the integer **`5`** remains constant during the lifetime. Similar is the case for float **`5.5`** and other objects." 116 | ] 117 | }, 118 | { 119 | "cell_type": "code", 120 | "execution_count": null, 121 | "metadata": {}, 122 | "outputs": [], 123 | "source": [] 124 | } 125 | ], 126 | "metadata": { 127 | "hide_input": false, 128 | "kernelspec": { 129 | "display_name": "Python 3", 130 | "language": "python", 131 | "name": "python3" 132 | }, 133 | "language_info": { 134 | "codemirror_mode": { 135 | "name": "ipython", 136 | "version": 3 137 | }, 138 | "file_extension": ".py", 139 | "mimetype": "text/x-python", 140 | "name": "python", 141 | "nbconvert_exporter": "python", 142 | "pygments_lexer": "ipython3", 143 | "version": "3.8.8" 144 | }, 145 | "toc": { 146 | "base_numbering": 1, 147 | "nav_menu": {}, 148 | "number_sections": true, 149 | "sideBar": true, 150 | "skip_h1_title": false, 151 | "title_cell": "Table of Contents", 152 | "title_sidebar": "Contents", 153 | "toc_cell": false, 154 | "toc_position": {}, 155 | "toc_section_display": true, 156 | "toc_window_display": false 157 | }, 158 | "varInspector": { 159 | "cols": { 160 | "lenName": 16, 161 | "lenType": 16, 162 | "lenVar": 40 163 | }, 164 | "kernels_config": { 165 | "python": { 166 | "delete_cmd_postfix": "", 167 | "delete_cmd_prefix": "del ", 168 | "library": "var_list.py", 169 | "varRefreshCmd": "print(var_dic_list())" 170 | }, 171 | "r": { 172 | "delete_cmd_postfix": ") ", 173 | "delete_cmd_prefix": "rm(", 174 | "library": "var_list.r", 175 | "varRefreshCmd": "cat(var_dic_list()) " 176 | } 177 | }, 178 | "types_to_exclude": [ 179 | "module", 180 | "function", 181 | "builtin_function_or_method", 182 | "instance", 183 | "_Feature" 184 | ], 185 | "window_display": false 186 | } 187 | }, 188 | "nbformat": 4, 189 | "nbformat_minor": 2 190 | } 191 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/034_Python_isinstance().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `isinstance()`\n", 17 | "\n", 18 | "The **`isinstance()`** function checks if the object (first argument) is an instance or subclass of classinfo class (second argument).\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "isinstance(object, classinfo)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `isinstance()` Parameters\n", 32 | "\n", 33 | "**`isinstance()`** takes two parameters:\n", 34 | "\n", 35 | "* **object** - **`object`** to be checked\n", 36 | "* **classinfo** - class, type, or tuple of classes and types" 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "## Return Value from `isinstance()`\n", 44 | "\n", 45 | "**`isinstance()`** returns:\n", 46 | "\n", 47 | "* **`True`** if the **`object`** is an instance or subclass of a class or any element of the tuple\n", 48 | "* **`False`** otherwise\n", 49 | "\n", 50 | "If **`classinfo`** is not a type or tuple of types, a **`TypeError`** exception is raised." 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": 1, 56 | "metadata": { 57 | "ExecuteTime": { 58 | "end_time": "2021-06-14T11:18:06.827975Z", 59 | "start_time": "2021-06-14T11:18:06.779150Z" 60 | }, 61 | "scrolled": false 62 | }, 63 | "outputs": [ 64 | { 65 | "name": "stdout", 66 | "output_type": "stream", 67 | "text": [ 68 | "True\n", 69 | "False\n", 70 | "True\n" 71 | ] 72 | } 73 | ], 74 | "source": [ 75 | "# Example 1: How isinstance() works?\n", 76 | "\n", 77 | "class Foo:\n", 78 | " a = 5\n", 79 | "\n", 80 | "fooInstance = Foo()\n", 81 | "\n", 82 | "print(isinstance(fooInstance, Foo))\n", 83 | "print(isinstance(fooInstance, (list, tuple)))\n", 84 | "print(isinstance(fooInstance, (list, tuple, Foo)))" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": 2, 90 | "metadata": { 91 | "ExecuteTime": { 92 | "end_time": "2021-06-14T11:18:08.014495Z", 93 | "start_time": "2021-06-14T11:18:08.001800Z" 94 | } 95 | }, 96 | "outputs": [ 97 | { 98 | "name": "stdout", 99 | "output_type": "stream", 100 | "text": [ 101 | "[1, 2, 3] instance of list? True\n", 102 | "[1, 2, 3] instance of dict? False\n", 103 | "[1, 2, 3] instance of dict or list? True\n", 104 | "5 instance of list? False\n", 105 | "5 instance of int? True\n" 106 | ] 107 | } 108 | ], 109 | "source": [ 110 | "# Example 2: Working of isinstance() with Native Types\n", 111 | "\n", 112 | "numbers = [1, 2, 3]\n", 113 | "\n", 114 | "result = isinstance(numbers, list)\n", 115 | "print(numbers,'instance of list?', result)\n", 116 | "\n", 117 | "result = isinstance(numbers, dict)\n", 118 | "print(numbers,'instance of dict?', result)\n", 119 | "\n", 120 | "result = isinstance(numbers, (dict, list))\n", 121 | "print(numbers,'instance of dict or list?', result)\n", 122 | "\n", 123 | "number = 5\n", 124 | "\n", 125 | "result = isinstance(number, list)\n", 126 | "print(number,'instance of list?', result)\n", 127 | "\n", 128 | "result = isinstance(number, int)\n", 129 | "print(number,'instance of int?', result)" 130 | ] 131 | }, 132 | { 133 | "cell_type": "code", 134 | "execution_count": null, 135 | "metadata": {}, 136 | "outputs": [], 137 | "source": [] 138 | } 139 | ], 140 | "metadata": { 141 | "hide_input": false, 142 | "kernelspec": { 143 | "display_name": "Python 3", 144 | "language": "python", 145 | "name": "python3" 146 | }, 147 | "language_info": { 148 | "codemirror_mode": { 149 | "name": "ipython", 150 | "version": 3 151 | }, 152 | "file_extension": ".py", 153 | "mimetype": "text/x-python", 154 | "name": "python", 155 | "nbconvert_exporter": "python", 156 | "pygments_lexer": "ipython3", 157 | "version": "3.8.8" 158 | }, 159 | "toc": { 160 | "base_numbering": 1, 161 | "nav_menu": {}, 162 | "number_sections": true, 163 | "sideBar": true, 164 | "skip_h1_title": false, 165 | "title_cell": "Table of Contents", 166 | "title_sidebar": "Contents", 167 | "toc_cell": false, 168 | "toc_position": {}, 169 | "toc_section_display": true, 170 | "toc_window_display": false 171 | }, 172 | "varInspector": { 173 | "cols": { 174 | "lenName": 16, 175 | "lenType": 16, 176 | "lenVar": 40 177 | }, 178 | "kernels_config": { 179 | "python": { 180 | "delete_cmd_postfix": "", 181 | "delete_cmd_prefix": "del ", 182 | "library": "var_list.py", 183 | "varRefreshCmd": "print(var_dic_list())" 184 | }, 185 | "r": { 186 | "delete_cmd_postfix": ") ", 187 | "delete_cmd_prefix": "rm(", 188 | "library": "var_list.r", 189 | "varRefreshCmd": "cat(var_dic_list()) " 190 | } 191 | }, 192 | "types_to_exclude": [ 193 | "module", 194 | "function", 195 | "builtin_function_or_method", 196 | "instance", 197 | "_Feature" 198 | ], 199 | "window_display": false 200 | } 201 | }, 202 | "nbformat": 4, 203 | "nbformat_minor": 2 204 | } 205 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/036_Python_issubclass().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `issubclass()`\n", 17 | "\n", 18 | "The **`issubclass()`** function checks if the class argument (first argument) is a subclass of classinfo class (second argument).\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "issubclass(class, classinfo)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `issubclass()` Parameters\n", 32 | "\n", 33 | "**`issubclass()`** takes two parameters:\n", 34 | "\n", 35 | "* **class** - class to be checked\n", 36 | "* **classinfo** - class, type, or tuple of classes and types" 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "## Return Value from `issubclass()`\n", 44 | "\n", 45 | "**`issubclass()`** returns:\n", 46 | "\n", 47 | "* **`True`** if **`class`** is subclass of a class, or any element of the tuple\n", 48 | "* **`False`** otherwise" 49 | ] 50 | }, 51 | { 52 | "cell_type": "code", 53 | "execution_count": 1, 54 | "metadata": { 55 | "ExecuteTime": { 56 | "end_time": "2021-06-14T11:18:41.318022Z", 57 | "start_time": "2021-06-14T11:18:41.307280Z" 58 | }, 59 | "scrolled": true 60 | }, 61 | "outputs": [ 62 | { 63 | "name": "stdout", 64 | "output_type": "stream", 65 | "text": [ 66 | "True\n", 67 | "False\n", 68 | "True\n", 69 | "True\n" 70 | ] 71 | } 72 | ], 73 | "source": [ 74 | "# Example 1: How issubclass() works?\n", 75 | "\n", 76 | "class Polygon:\n", 77 | " def __init__(polygonType):\n", 78 | " print('Polygon is a ', polygonType)\n", 79 | "\n", 80 | "class Triangle(Polygon):\n", 81 | " def __init__(self):\n", 82 | "\n", 83 | " Polygon.__init__('triangle')\n", 84 | " \n", 85 | "print(issubclass(Triangle, Polygon))\n", 86 | "print(issubclass(Triangle, list))\n", 87 | "print(issubclass(Triangle, (list, Polygon)))\n", 88 | "print(issubclass(Polygon, (list, Polygon)))" 89 | ] 90 | }, 91 | { 92 | "cell_type": "markdown", 93 | "metadata": {}, 94 | "source": [ 95 | "It's important to note that class is considered a subclass of itself." 96 | ] 97 | }, 98 | { 99 | "cell_type": "code", 100 | "execution_count": null, 101 | "metadata": {}, 102 | "outputs": [], 103 | "source": [] 104 | } 105 | ], 106 | "metadata": { 107 | "hide_input": false, 108 | "kernelspec": { 109 | "display_name": "Python 3", 110 | "language": "python", 111 | "name": "python3" 112 | }, 113 | "language_info": { 114 | "codemirror_mode": { 115 | "name": "ipython", 116 | "version": 3 117 | }, 118 | "file_extension": ".py", 119 | "mimetype": "text/x-python", 120 | "name": "python", 121 | "nbconvert_exporter": "python", 122 | "pygments_lexer": "ipython3", 123 | "version": "3.8.8" 124 | }, 125 | "toc": { 126 | "base_numbering": 1, 127 | "nav_menu": {}, 128 | "number_sections": true, 129 | "sideBar": true, 130 | "skip_h1_title": false, 131 | "title_cell": "Table of Contents", 132 | "title_sidebar": "Contents", 133 | "toc_cell": false, 134 | "toc_position": {}, 135 | "toc_section_display": true, 136 | "toc_window_display": false 137 | }, 138 | "varInspector": { 139 | "cols": { 140 | "lenName": 16, 141 | "lenType": 16, 142 | "lenVar": 40 143 | }, 144 | "kernels_config": { 145 | "python": { 146 | "delete_cmd_postfix": "", 147 | "delete_cmd_prefix": "del ", 148 | "library": "var_list.py", 149 | "varRefreshCmd": "print(var_dic_list())" 150 | }, 151 | "r": { 152 | "delete_cmd_postfix": ") ", 153 | "delete_cmd_prefix": "rm(", 154 | "library": "var_list.r", 155 | "varRefreshCmd": "cat(var_dic_list()) " 156 | } 157 | }, 158 | "types_to_exclude": [ 159 | "module", 160 | "function", 161 | "builtin_function_or_method", 162 | "instance", 163 | "_Feature" 164 | ], 165 | "window_display": false 166 | } 167 | }, 168 | "nbformat": 4, 169 | "nbformat_minor": 2 170 | } 171 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/046_Python_object().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `object()`\n", 17 | "\n", 18 | "The **`object()`** function returns a featureless object which is a base for all classes.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "o = object()\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `object()` Parameters\n", 32 | "\n", 33 | "The **`object()`** function doesn't accept any parameters." 34 | ] 35 | }, 36 | { 37 | "cell_type": "markdown", 38 | "metadata": {}, 39 | "source": [ 40 | "## Return Value from `object()`\n", 41 | "\n", 42 | "The **`object()`** function function returns a featureless object." 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 1, 48 | "metadata": { 49 | "ExecuteTime": { 50 | "end_time": "2021-06-14T11:22:35.935922Z", 51 | "start_time": "2021-06-14T11:22:35.910531Z" 52 | }, 53 | "scrolled": false 54 | }, 55 | "outputs": [ 56 | { 57 | "name": "stdout", 58 | "output_type": "stream", 59 | "text": [ 60 | "\n", 61 | "['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']\n" 62 | ] 63 | } 64 | ], 65 | "source": [ 66 | "# Example: How object() works?\n", 67 | "\n", 68 | "test = object()\n", 69 | "\n", 70 | "print(type(test))\n", 71 | "print(dir(test))" 72 | ] 73 | }, 74 | { 75 | "cell_type": "markdown", 76 | "metadata": {}, 77 | "source": [ 78 | "Here, an object **`test`** is created.\n", 79 | "\n", 80 | "In the program, we have used **[type()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/064_Python_type%28%29.ipynb)** to get the type of the object.\n", 81 | "\n", 82 | "Similarly, we have used **[dir()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/016_Python_dir%28%29.ipynb)** to get all the attributes. These attributes (properties and methods) are common to instances of all Python classes." 83 | ] 84 | }, 85 | { 86 | "cell_type": "code", 87 | "execution_count": null, 88 | "metadata": {}, 89 | "outputs": [], 90 | "source": [] 91 | } 92 | ], 93 | "metadata": { 94 | "hide_input": false, 95 | "kernelspec": { 96 | "display_name": "Python 3", 97 | "language": "python", 98 | "name": "python3" 99 | }, 100 | "language_info": { 101 | "codemirror_mode": { 102 | "name": "ipython", 103 | "version": 3 104 | }, 105 | "file_extension": ".py", 106 | "mimetype": "text/x-python", 107 | "name": "python", 108 | "nbconvert_exporter": "python", 109 | "pygments_lexer": "ipython3", 110 | "version": "3.8.8" 111 | }, 112 | "toc": { 113 | "base_numbering": 1, 114 | "nav_menu": {}, 115 | "number_sections": true, 116 | "sideBar": true, 117 | "skip_h1_title": false, 118 | "title_cell": "Table of Contents", 119 | "title_sidebar": "Contents", 120 | "toc_cell": false, 121 | "toc_position": {}, 122 | "toc_section_display": true, 123 | "toc_window_display": false 124 | }, 125 | "varInspector": { 126 | "cols": { 127 | "lenName": 16, 128 | "lenType": 16, 129 | "lenVar": 40 130 | }, 131 | "kernels_config": { 132 | "python": { 133 | "delete_cmd_postfix": "", 134 | "delete_cmd_prefix": "del ", 135 | "library": "var_list.py", 136 | "varRefreshCmd": "print(var_dic_list())" 137 | }, 138 | "r": { 139 | "delete_cmd_postfix": ") ", 140 | "delete_cmd_prefix": "rm(", 141 | "library": "var_list.r", 142 | "varRefreshCmd": "cat(var_dic_list()) " 143 | } 144 | }, 145 | "types_to_exclude": [ 146 | "module", 147 | "function", 148 | "builtin_function_or_method", 149 | "instance", 150 | "_Feature" 151 | ], 152 | "window_display": false 153 | } 154 | }, 155 | "nbformat": 4, 156 | "nbformat_minor": 2 157 | } 158 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/047_Python_oct().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `oct()`\n", 17 | "\n", 18 | "The **`oct()`** function takes an integer number and returns its octal representation.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "oct(x)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `oct()` Parameters\n", 32 | "\n", 33 | "The **`oct()`** function takes a single parameter x.\n", 34 | "\n", 35 | "This parameter could be:\n", 36 | "\n", 37 | "* an integer number (binary, decimal or hexadecimal)\n", 38 | "* if not an integer, it should implement **`__index__()`** to return an integer" 39 | ] 40 | }, 41 | { 42 | "cell_type": "markdown", 43 | "metadata": {}, 44 | "source": [ 45 | "## Return Value from `oct()`\n", 46 | "\n", 47 | "The **`oct()`** function returns an octal string from the given integer number." 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": 1, 53 | "metadata": { 54 | "ExecuteTime": { 55 | "end_time": "2021-06-14T11:22:48.738105Z", 56 | "start_time": "2021-06-14T11:22:48.725410Z" 57 | }, 58 | "scrolled": false 59 | }, 60 | "outputs": [ 61 | { 62 | "name": "stdout", 63 | "output_type": "stream", 64 | "text": [ 65 | "oct(10) is: 0o12\n", 66 | "oct(0b101) is: 0o5\n", 67 | "oct(0XA) is: 0o12\n" 68 | ] 69 | } 70 | ], 71 | "source": [ 72 | "# Example 1: How oct() works in Python?\n", 73 | "\n", 74 | "# decimal to octal\n", 75 | "print('oct(10) is:', oct(10))\n", 76 | "\n", 77 | "# binary to octal\n", 78 | "print('oct(0b101) is:', oct(0b101))\n", 79 | "\n", 80 | "# hexadecimal to octal\n", 81 | "print('oct(0XA) is:', oct(0XA))" 82 | ] 83 | }, 84 | { 85 | "cell_type": "code", 86 | "execution_count": 2, 87 | "metadata": { 88 | "ExecuteTime": { 89 | "end_time": "2021-06-14T11:22:50.244933Z", 90 | "start_time": "2021-06-14T11:22:50.228332Z" 91 | }, 92 | "scrolled": true 93 | }, 94 | "outputs": [ 95 | { 96 | "name": "stdout", 97 | "output_type": "stream", 98 | "text": [ 99 | "The oct is: 0o27\n" 100 | ] 101 | } 102 | ], 103 | "source": [ 104 | "# Example 2: oct() for custom objects\n", 105 | "\n", 106 | "class Person:\n", 107 | " age = 23\n", 108 | "\n", 109 | " def __index__(self):\n", 110 | " return self.age\n", 111 | "\n", 112 | " def __int__(self):\n", 113 | " return self.age\n", 114 | "\n", 115 | "person = Person()\n", 116 | "print('The oct is:', oct(person))" 117 | ] 118 | }, 119 | { 120 | "cell_type": "markdown", 121 | "metadata": {}, 122 | "source": [ 123 | "Here, the Person class implements **`__int__()`** and **`__index__()`**. That's why we can use **`oct()`** on the objects of Person.\n", 124 | "\n", 125 | "> **Note:** For compatibility, it's recommended to implement **`__int__()`** and **`__index__()`** with the same output." 126 | ] 127 | }, 128 | { 129 | "cell_type": "code", 130 | "execution_count": null, 131 | "metadata": {}, 132 | "outputs": [], 133 | "source": [] 134 | } 135 | ], 136 | "metadata": { 137 | "hide_input": false, 138 | "kernelspec": { 139 | "display_name": "Python 3", 140 | "language": "python", 141 | "name": "python3" 142 | }, 143 | "language_info": { 144 | "codemirror_mode": { 145 | "name": "ipython", 146 | "version": 3 147 | }, 148 | "file_extension": ".py", 149 | "mimetype": "text/x-python", 150 | "name": "python", 151 | "nbconvert_exporter": "python", 152 | "pygments_lexer": "ipython3", 153 | "version": "3.8.8" 154 | }, 155 | "toc": { 156 | "base_numbering": 1, 157 | "nav_menu": {}, 158 | "number_sections": true, 159 | "sideBar": true, 160 | "skip_h1_title": false, 161 | "title_cell": "Table of Contents", 162 | "title_sidebar": "Contents", 163 | "toc_cell": false, 164 | "toc_position": {}, 165 | "toc_section_display": true, 166 | "toc_window_display": false 167 | }, 168 | "varInspector": { 169 | "cols": { 170 | "lenName": 16, 171 | "lenType": 16, 172 | "lenVar": 40 173 | }, 174 | "kernels_config": { 175 | "python": { 176 | "delete_cmd_postfix": "", 177 | "delete_cmd_prefix": "del ", 178 | "library": "var_list.py", 179 | "varRefreshCmd": "print(var_dic_list())" 180 | }, 181 | "r": { 182 | "delete_cmd_postfix": ") ", 183 | "delete_cmd_prefix": "rm(", 184 | "library": "var_list.r", 185 | "varRefreshCmd": "cat(var_dic_list()) " 186 | } 187 | }, 188 | "types_to_exclude": [ 189 | "module", 190 | "function", 191 | "builtin_function_or_method", 192 | "instance", 193 | "_Feature" 194 | ], 195 | "window_display": false 196 | } 197 | }, 198 | "nbformat": 4, 199 | "nbformat_minor": 2 200 | } 201 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/048_Python_ord().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `ord()`\n", 17 | "\n", 18 | "The **`ord()`** function returns an integer representing the Unicode character.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "ord(ch)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `ord()` Parameters\n", 32 | "\n", 33 | "The **`ord()`** function takes a single parameter:\n", 34 | "\n", 35 | "* **ch** - a Unicode character" 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "## Return Value from `ord()`\n", 43 | "\n", 44 | "The **`ord()`** function returns an integer representing the Unicode character." 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": 1, 50 | "metadata": { 51 | "ExecuteTime": { 52 | "end_time": "2021-06-14T11:23:01.485603Z", 53 | "start_time": "2021-06-14T11:23:01.469977Z" 54 | }, 55 | "scrolled": false 56 | }, 57 | "outputs": [ 58 | { 59 | "name": "stdout", 60 | "output_type": "stream", 61 | "text": [ 62 | "53\n", 63 | "65\n", 64 | "36\n" 65 | ] 66 | } 67 | ], 68 | "source": [ 69 | "# Example: How ord() works in Python?\n", 70 | "\n", 71 | "print(ord('5')) # 53\n", 72 | "print(ord('A')) # 65\n", 73 | "print(ord('$')) # 36" 74 | ] 75 | }, 76 | { 77 | "cell_type": "markdown", 78 | "metadata": {}, 79 | "source": [ 80 | "By the way, the **`ord()`** function is the inverse of the **[Python chr() function](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/010_Python_chr%28%29.ipynb)**." 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": null, 86 | "metadata": {}, 87 | "outputs": [], 88 | "source": [] 89 | } 90 | ], 91 | "metadata": { 92 | "hide_input": false, 93 | "kernelspec": { 94 | "display_name": "Python 3", 95 | "language": "python", 96 | "name": "python3" 97 | }, 98 | "language_info": { 99 | "codemirror_mode": { 100 | "name": "ipython", 101 | "version": 3 102 | }, 103 | "file_extension": ".py", 104 | "mimetype": "text/x-python", 105 | "name": "python", 106 | "nbconvert_exporter": "python", 107 | "pygments_lexer": "ipython3", 108 | "version": "3.8.8" 109 | }, 110 | "toc": { 111 | "base_numbering": 1, 112 | "nav_menu": {}, 113 | "number_sections": true, 114 | "sideBar": true, 115 | "skip_h1_title": false, 116 | "title_cell": "Table of Contents", 117 | "title_sidebar": "Contents", 118 | "toc_cell": false, 119 | "toc_position": {}, 120 | "toc_section_display": true, 121 | "toc_window_display": false 122 | }, 123 | "varInspector": { 124 | "cols": { 125 | "lenName": 16, 126 | "lenType": 16, 127 | "lenVar": 40 128 | }, 129 | "kernels_config": { 130 | "python": { 131 | "delete_cmd_postfix": "", 132 | "delete_cmd_prefix": "del ", 133 | "library": "var_list.py", 134 | "varRefreshCmd": "print(var_dic_list())" 135 | }, 136 | "r": { 137 | "delete_cmd_postfix": ") ", 138 | "delete_cmd_prefix": "rm(", 139 | "library": "var_list.r", 140 | "varRefreshCmd": "cat(var_dic_list()) " 141 | } 142 | }, 143 | "types_to_exclude": [ 144 | "module", 145 | "function", 146 | "builtin_function_or_method", 147 | "instance", 148 | "_Feature" 149 | ], 150 | "window_display": false 151 | } 152 | }, 153 | "nbformat": 4, 154 | "nbformat_minor": 2 155 | } 156 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/050_Python_pow().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `pow()`\n", 17 | "\n", 18 | "The **`pow()`** function returns the power of a number.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "pow(x, y, z)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `pow()` Parameters\n", 32 | "\n", 33 | "The pow() function takes three parameters:\n", 34 | "\n", 35 | "* **x** - a number, the base\n", 36 | "* **y** - a number, the exponent\n", 37 | "* **z (optional)** - a number, used for modulus\n", 38 | "\n", 39 | "Hence,\n", 40 | "\n", 41 | "* **`pow(x, y)`** is equal to **$x^y$**\n", 42 | "* **`pow(x, y, z)`** is equal to **$x^y$`% z`**" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 1, 48 | "metadata": { 49 | "ExecuteTime": { 50 | "end_time": "2021-06-14T11:31:28.198442Z", 51 | "start_time": "2021-06-14T11:31:28.190631Z" 52 | }, 53 | "scrolled": true 54 | }, 55 | "outputs": [ 56 | { 57 | "name": "stdout", 58 | "output_type": "stream", 59 | "text": [ 60 | "4\n", 61 | "4\n", 62 | "0.25\n", 63 | "0.25\n" 64 | ] 65 | } 66 | ], 67 | "source": [ 68 | "# Example 1: Python pow()\n", 69 | "\n", 70 | "# positive x, positive y (x**y)\n", 71 | "print(pow(2, 2)) # 4\n", 72 | "\n", 73 | "# negative x, positive y\n", 74 | "print(pow(-2, 2)) # 4 \n", 75 | "\n", 76 | "# positive x, negative y\n", 77 | "print(pow(2, -2)) # 0.25\n", 78 | "\n", 79 | "# negative x, negative y\n", 80 | "print(pow(-2, -2)) # 0.25" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": 2, 86 | "metadata": { 87 | "ExecuteTime": { 88 | "end_time": "2021-06-14T11:31:29.458198Z", 89 | "start_time": "2021-06-14T11:31:29.436717Z" 90 | } 91 | }, 92 | "outputs": [ 93 | { 94 | "name": "stdout", 95 | "output_type": "stream", 96 | "text": [ 97 | "4\n" 98 | ] 99 | } 100 | ], 101 | "source": [ 102 | "# Example 2: pow() with three arguments (x**y) % z\n", 103 | "\n", 104 | "x = 7\n", 105 | "y = 2\n", 106 | "z = 5\n", 107 | "\n", 108 | "print(pow(x, y, z)) # 4" 109 | ] 110 | }, 111 | { 112 | "cell_type": "markdown", 113 | "metadata": {}, 114 | "source": [ 115 | "Here, 7 powered by 2 equals 49. Then, 49 modulus 5 equals 4." 116 | ] 117 | }, 118 | { 119 | "cell_type": "code", 120 | "execution_count": null, 121 | "metadata": {}, 122 | "outputs": [], 123 | "source": [] 124 | } 125 | ], 126 | "metadata": { 127 | "hide_input": false, 128 | "kernelspec": { 129 | "display_name": "Python 3", 130 | "language": "python", 131 | "name": "python3" 132 | }, 133 | "language_info": { 134 | "codemirror_mode": { 135 | "name": "ipython", 136 | "version": 3 137 | }, 138 | "file_extension": ".py", 139 | "mimetype": "text/x-python", 140 | "name": "python", 141 | "nbconvert_exporter": "python", 142 | "pygments_lexer": "ipython3", 143 | "version": "3.8.8" 144 | }, 145 | "toc": { 146 | "base_numbering": 1, 147 | "nav_menu": {}, 148 | "number_sections": true, 149 | "sideBar": true, 150 | "skip_h1_title": false, 151 | "title_cell": "Table of Contents", 152 | "title_sidebar": "Contents", 153 | "toc_cell": false, 154 | "toc_position": {}, 155 | "toc_section_display": true, 156 | "toc_window_display": false 157 | }, 158 | "varInspector": { 159 | "cols": { 160 | "lenName": 16, 161 | "lenType": 16, 162 | "lenVar": 40 163 | }, 164 | "kernels_config": { 165 | "python": { 166 | "delete_cmd_postfix": "", 167 | "delete_cmd_prefix": "del ", 168 | "library": "var_list.py", 169 | "varRefreshCmd": "print(var_dic_list())" 170 | }, 171 | "r": { 172 | "delete_cmd_postfix": ") ", 173 | "delete_cmd_prefix": "rm(", 174 | "library": "var_list.r", 175 | "varRefreshCmd": "cat(var_dic_list()) " 176 | } 177 | }, 178 | "types_to_exclude": [ 179 | "module", 180 | "function", 181 | "builtin_function_or_method", 182 | "instance", 183 | "_Feature" 184 | ], 185 | "window_display": false 186 | } 187 | }, 188 | "nbformat": 4, 189 | "nbformat_minor": 2 190 | } 191 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/054_Python_repr().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `repr()`\n", 17 | "\n", 18 | "The **`repr()`** function returns a printable representation of the given object.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "repr(obj)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `repr()` Parameters\n", 32 | "\n", 33 | "The **`repr()`** function takes a single parameter:\n", 34 | "\n", 35 | "* **obj** - the object whose printable representation has to be returned" 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "## Return Value from `property()`\n", 43 | "\n", 44 | "The **`repr()`** function returns a printable representational string of the given object." 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": 1, 50 | "metadata": { 51 | "ExecuteTime": { 52 | "end_time": "2021-06-14T11:33:11.405437Z", 53 | "start_time": "2021-06-14T11:33:11.393718Z" 54 | }, 55 | "scrolled": true 56 | }, 57 | "outputs": [ 58 | { 59 | "name": "stdout", 60 | "output_type": "stream", 61 | "text": [ 62 | "'foo'\n" 63 | ] 64 | } 65 | ], 66 | "source": [ 67 | "# Example 1: How repr() works in Python?\n", 68 | "\n", 69 | "var = 'foo'\n", 70 | "\n", 71 | "print(repr(var))" 72 | ] 73 | }, 74 | { 75 | "cell_type": "markdown", 76 | "metadata": {}, 77 | "source": [ 78 | "Here, we assign a value **`'foo'`** to **`var`**. Then, the **`repr()`** function returns **`\"'foo'\"`**, **`'foo'`** inside double-quotes.\n", 79 | "\n", 80 | "When the result from **`repr()`** is passed to **`eval()`**, we will get the original object (for many types)." 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": 2, 86 | "metadata": { 87 | "ExecuteTime": { 88 | "end_time": "2021-06-14T11:33:12.911284Z", 89 | "start_time": "2021-06-14T11:33:12.889804Z" 90 | } 91 | }, 92 | "outputs": [ 93 | { 94 | "name": "stdout", 95 | "output_type": "stream", 96 | "text": [ 97 | "'Hello Adam'\n" 98 | ] 99 | } 100 | ], 101 | "source": [ 102 | "# Example 2: Implement __repr__() for custom objects\n", 103 | "\n", 104 | "# Internally, repr()function calls __repr__() of the given object.\n", 105 | "\n", 106 | "# You can easily implement/override __repr__() so that repr() works differently.\n", 107 | "\n", 108 | "class Person:\n", 109 | " name = 'Adam'\n", 110 | "\n", 111 | " def __repr__(self):\n", 112 | " return repr('Hello ' + self.name )\n", 113 | "\n", 114 | "print(repr(Person()))" 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "execution_count": null, 120 | "metadata": {}, 121 | "outputs": [], 122 | "source": [] 123 | } 124 | ], 125 | "metadata": { 126 | "hide_input": false, 127 | "kernelspec": { 128 | "display_name": "Python 3", 129 | "language": "python", 130 | "name": "python3" 131 | }, 132 | "language_info": { 133 | "codemirror_mode": { 134 | "name": "ipython", 135 | "version": 3 136 | }, 137 | "file_extension": ".py", 138 | "mimetype": "text/x-python", 139 | "name": "python", 140 | "nbconvert_exporter": "python", 141 | "pygments_lexer": "ipython3", 142 | "version": "3.8.8" 143 | }, 144 | "toc": { 145 | "base_numbering": 1, 146 | "nav_menu": {}, 147 | "number_sections": true, 148 | "sideBar": true, 149 | "skip_h1_title": false, 150 | "title_cell": "Table of Contents", 151 | "title_sidebar": "Contents", 152 | "toc_cell": false, 153 | "toc_position": {}, 154 | "toc_section_display": true, 155 | "toc_window_display": false 156 | }, 157 | "varInspector": { 158 | "cols": { 159 | "lenName": 16, 160 | "lenType": 16, 161 | "lenVar": 40 162 | }, 163 | "kernels_config": { 164 | "python": { 165 | "delete_cmd_postfix": "", 166 | "delete_cmd_prefix": "del ", 167 | "library": "var_list.py", 168 | "varRefreshCmd": "print(var_dic_list())" 169 | }, 170 | "r": { 171 | "delete_cmd_postfix": ") ", 172 | "delete_cmd_prefix": "rm(", 173 | "library": "var_list.r", 174 | "varRefreshCmd": "cat(var_dic_list()) " 175 | } 176 | }, 177 | "types_to_exclude": [ 178 | "module", 179 | "function", 180 | "builtin_function_or_method", 181 | "instance", 182 | "_Feature" 183 | ], 184 | "window_display": false 185 | } 186 | }, 187 | "nbformat": 4, 188 | "nbformat_minor": 2 189 | } 190 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/056_Python_round().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `round()`\n", 17 | "\n", 18 | "The **`round()`** function returns a floating-point number rounded to the specified number of decimals.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "round(number, ndigits)\n", 24 | "```" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "## `round()` Parameters\n", 32 | "\n", 33 | "The **`round()`** function takes two parameters:\n", 34 | "\n", 35 | "* **number** - the number to be rounded\n", 36 | "* **ndigits (optional)** - number up to which the given number is rounded; defaults to 0" 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "## Return Value from `round()`\n", 44 | "\n", 45 | "* If **`ndigits`** is not provided, **`round()`** returns the nearest integer to the given number.\n", 46 | "* If **`ndigits`** is given, **`round()`** returns the number rounded off to the **`ndigits`** digits." 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 1, 52 | "metadata": { 53 | "scrolled": true 54 | }, 55 | "outputs": [ 56 | { 57 | "name": "stdout", 58 | "output_type": "stream", 59 | "text": [ 60 | "10\n", 61 | "11\n", 62 | "6\n" 63 | ] 64 | } 65 | ], 66 | "source": [ 67 | "# Example 1: How round() works in Python?\n", 68 | "\n", 69 | "# for integers\n", 70 | "print(round(10))\n", 71 | "\n", 72 | "# for floating point\n", 73 | "print(round(10.7))\n", 74 | "\n", 75 | "# even choice\n", 76 | "print(round(5.5))" 77 | ] 78 | }, 79 | { 80 | "cell_type": "code", 81 | "execution_count": 2, 82 | "metadata": {}, 83 | "outputs": [ 84 | { 85 | "name": "stdout", 86 | "output_type": "stream", 87 | "text": [ 88 | "2.67\n", 89 | "2.67\n" 90 | ] 91 | } 92 | ], 93 | "source": [ 94 | "# Example 2: Round a number to the given number of decimal places\n", 95 | "\n", 96 | "print(round(2.665, 2))\n", 97 | "print(round(2.675, 2))" 98 | ] 99 | }, 100 | { 101 | "cell_type": "markdown", 102 | "metadata": {}, 103 | "source": [ 104 | ">**Note:** The behavior of **`round()`** for floats can be surprising. Notice **`round(2.675, 2) `** gives **`2.67`** instead of the expected **`2.68`**. This is not a bug: it's a result of the fact that most decimal fractions can't be represented exactly as a float.\n", 105 | "When the decimal **`2.675`** is converted to a binary floating-point number, it's again replaced with a binary approximation, whose exact value is:\n", 106 | "```python\n", 107 | "2.67499999999999982236431605997495353221893310546875\n", 108 | "```\n", 109 | "Due to this, it is rounded down to 2.67." 110 | ] 111 | }, 112 | { 113 | "cell_type": "markdown", 114 | "metadata": {}, 115 | "source": [ 116 | "If you're in a situation where this precision is needed, consider using the **`decimal`** module, which is designed for floating-point arithmetic:" 117 | ] 118 | }, 119 | { 120 | "cell_type": "code", 121 | "execution_count": 3, 122 | "metadata": {}, 123 | "outputs": [ 124 | { 125 | "name": "stdout", 126 | "output_type": "stream", 127 | "text": [ 128 | "2.67\n", 129 | "2.68\n" 130 | ] 131 | } 132 | ], 133 | "source": [ 134 | "# Example 3:\n", 135 | "\n", 136 | "from decimal import Decimal\n", 137 | "\n", 138 | "# normal float\n", 139 | "num = 2.675\n", 140 | "print(round(num, 2))\n", 141 | "\n", 142 | "# using decimal.Decimal (passed float as string for precision)\n", 143 | "num = Decimal('2.675')\n", 144 | "print(round(num, 2))" 145 | ] 146 | }, 147 | { 148 | "cell_type": "code", 149 | "execution_count": null, 150 | "metadata": {}, 151 | "outputs": [], 152 | "source": [] 153 | } 154 | ], 155 | "metadata": { 156 | "kernelspec": { 157 | "display_name": "Python 3", 158 | "language": "python", 159 | "name": "python3" 160 | }, 161 | "language_info": { 162 | "codemirror_mode": { 163 | "name": "ipython", 164 | "version": 3 165 | }, 166 | "file_extension": ".py", 167 | "mimetype": "text/x-python", 168 | "name": "python", 169 | "nbconvert_exporter": "python", 170 | "pygments_lexer": "ipython3", 171 | "version": "3.8.8" 172 | } 173 | }, 174 | "nbformat": 4, 175 | "nbformat_minor": 2 176 | } 177 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/058_Python_setattr().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `setattr()`\n", 17 | "\n", 18 | "The **`setattr()`** function sets the value of the attribute of an object.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "setattr(object, name, value)\n", 24 | "```\n", 25 | "\n", 26 | "If you want to get the attribute of an object, use **[getattr()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/025_Python_getattr%28%29.ipynb)**." 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "## `setattr()` Parameters\n", 34 | "\n", 35 | "The **`setattr()`** function takes three parameters:\n", 36 | "\n", 37 | "* **object** - object whose attribute has to be set\n", 38 | "* **name** - attribute name\n", 39 | "* **value** - value given to the attribute" 40 | ] 41 | }, 42 | { 43 | "cell_type": "markdown", 44 | "metadata": {}, 45 | "source": [ 46 | "## Return Value from `setattr()`\n", 47 | "\n", 48 | "The **`setattr()`** method doesn't return anything; returns **`None`**." 49 | ] 50 | }, 51 | { 52 | "cell_type": "code", 53 | "execution_count": 1, 54 | "metadata": { 55 | "ExecuteTime": { 56 | "end_time": "2021-06-14T11:37:20.226325Z", 57 | "start_time": "2021-06-14T11:37:20.209725Z" 58 | }, 59 | "scrolled": true 60 | }, 61 | "outputs": [ 62 | { 63 | "name": "stdout", 64 | "output_type": "stream", 65 | "text": [ 66 | "Before modification: Adam\n", 67 | "After modification: John\n" 68 | ] 69 | } 70 | ], 71 | "source": [ 72 | "# Example 1: How setattr() works in Python?\n", 73 | "\n", 74 | "class Person:\n", 75 | " name = 'Adam'\n", 76 | " \n", 77 | "p = Person()\n", 78 | "print('Before modification:', p.name)\n", 79 | "\n", 80 | "# setting name to 'John'\n", 81 | "setattr(p, 'name', 'John')\n", 82 | "\n", 83 | "print('After modification:', p.name)" 84 | ] 85 | }, 86 | { 87 | "cell_type": "code", 88 | "execution_count": 2, 89 | "metadata": { 90 | "ExecuteTime": { 91 | "end_time": "2021-06-14T11:37:24.877178Z", 92 | "start_time": "2021-06-14T11:37:24.866923Z" 93 | } 94 | }, 95 | "outputs": [ 96 | { 97 | "name": "stdout", 98 | "output_type": "stream", 99 | "text": [ 100 | "Name is: John\n", 101 | "Age is: 23\n" 102 | ] 103 | } 104 | ], 105 | "source": [ 106 | "# Example 2: When the attribute is not found in setattr()\n", 107 | "\n", 108 | "# If the attribute is not found, setattr() creates a new attribute an assigns value to it. \n", 109 | "# However, this is only possible if the object implements the __dict__() method.\n", 110 | "\n", 111 | "# You can check all the attributes of an object by using the dir() function.\n", 112 | "\n", 113 | "class Person:\n", 114 | " name = 'Adam'\n", 115 | " \n", 116 | "p = Person()\n", 117 | "\n", 118 | "# setting attribute name to John\n", 119 | "setattr(p, 'name', 'John')\n", 120 | "print('Name is:', p.name)\n", 121 | "\n", 122 | "# setting an attribute not present in Person\n", 123 | "setattr(p, 'age', 23)\n", 124 | "print('Age is:', p.age)" 125 | ] 126 | }, 127 | { 128 | "cell_type": "markdown", 129 | "metadata": {}, 130 | "source": [ 131 | "In above example, You can check all the attributes of an object by using the **[dir() function](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/016_Python_dir().ipynb)**." 132 | ] 133 | }, 134 | { 135 | "cell_type": "code", 136 | "execution_count": null, 137 | "metadata": {}, 138 | "outputs": [], 139 | "source": [] 140 | } 141 | ], 142 | "metadata": { 143 | "hide_input": false, 144 | "kernelspec": { 145 | "display_name": "Python 3", 146 | "language": "python", 147 | "name": "python3" 148 | }, 149 | "language_info": { 150 | "codemirror_mode": { 151 | "name": "ipython", 152 | "version": 3 153 | }, 154 | "file_extension": ".py", 155 | "mimetype": "text/x-python", 156 | "name": "python", 157 | "nbconvert_exporter": "python", 158 | "pygments_lexer": "ipython3", 159 | "version": "3.8.8" 160 | }, 161 | "toc": { 162 | "base_numbering": 1, 163 | "nav_menu": {}, 164 | "number_sections": true, 165 | "sideBar": true, 166 | "skip_h1_title": false, 167 | "title_cell": "Table of Contents", 168 | "title_sidebar": "Contents", 169 | "toc_cell": false, 170 | "toc_position": {}, 171 | "toc_section_display": true, 172 | "toc_window_display": false 173 | }, 174 | "varInspector": { 175 | "cols": { 176 | "lenName": 16, 177 | "lenType": 16, 178 | "lenVar": 40 179 | }, 180 | "kernels_config": { 181 | "python": { 182 | "delete_cmd_postfix": "", 183 | "delete_cmd_prefix": "del ", 184 | "library": "var_list.py", 185 | "varRefreshCmd": "print(var_dic_list())" 186 | }, 187 | "r": { 188 | "delete_cmd_postfix": ") ", 189 | "delete_cmd_prefix": "rm(", 190 | "library": "var_list.r", 191 | "varRefreshCmd": "cat(var_dic_list()) " 192 | } 193 | }, 194 | "types_to_exclude": [ 195 | "module", 196 | "function", 197 | "builtin_function_or_method", 198 | "instance", 199 | "_Feature" 200 | ], 201 | "window_display": false 202 | } 203 | }, 204 | "nbformat": 4, 205 | "nbformat_minor": 2 206 | } 207 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/062_Python_sum().ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `sum()`\n", 17 | "\n", 18 | "The **`sum()`** function adds the items of an iterable and returns the sum.\n", 19 | "\n", 20 | "**Syntax**:\n", 21 | "\n", 22 | "```python\n", 23 | "sum(iterable, start)\n", 24 | "```\n", 25 | "\n", 26 | "The **`sum()`** function adds **`start`** and items of the given **`iterable`** from left to right." 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "## `sum()` Parameters\n", 34 | "\n", 35 | "* **iterable** - iterable (list, tuple, dict, etc). The items of the iterable should be numbers.\n", 36 | "* **start (optional)** - this value is added to the sum of items of the iterable. The default value of **`start`** is 0 (if omitted)\n" 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "## Return value from `sum()`\n", 44 | "\n", 45 | "**`sum()`** returns the sum of **`start`** and items of the given **`iterable`**." 46 | ] 47 | }, 48 | { 49 | "cell_type": "code", 50 | "execution_count": 1, 51 | "metadata": { 52 | "ExecuteTime": { 53 | "end_time": "2021-06-14T11:38:53.413757Z", 54 | "start_time": "2021-06-14T11:38:53.398135Z" 55 | }, 56 | "scrolled": false 57 | }, 58 | "outputs": [ 59 | { 60 | "name": "stdout", 61 | "output_type": "stream", 62 | "text": [ 63 | "4.5\n", 64 | "14.5\n" 65 | ] 66 | } 67 | ], 68 | "source": [ 69 | "# Example: Working of Python sum()\n", 70 | "\n", 71 | "numbers = [2.5, 3, 4, -5]\n", 72 | "\n", 73 | "# start parameter is not provided\n", 74 | "numbers_sum = sum(numbers)\n", 75 | "print(numbers_sum)\n", 76 | "\n", 77 | "# start = 10\n", 78 | "numbers_sum = sum(numbers, 10)\n", 79 | "print(numbers_sum)" 80 | ] 81 | }, 82 | { 83 | "cell_type": "markdown", 84 | "metadata": {}, 85 | "source": [ 86 | "If you need to add floating-point numbers with exact precision, then you should use **`math.fsum(iterable)`** instead.\n", 87 | "\n", 88 | "If you need to concatenate items of the given iterable (items must be strings), then you can use the **`join()`** method.\n", 89 | "\n", 90 | "```python\n", 91 | "'string'.join(sequence)\n", 92 | "```\n", 93 | "\n", 94 | "Visit this page to learn about, **[Python join() Method](https://github.com/milaan9/02_Python_Datatypes/blob/main/002_Python_String_Methods/022_Python_String_join%28%29.ipynb)**." 95 | ] 96 | }, 97 | { 98 | "cell_type": "code", 99 | "execution_count": null, 100 | "metadata": {}, 101 | "outputs": [], 102 | "source": [] 103 | } 104 | ], 105 | "metadata": { 106 | "hide_input": false, 107 | "kernelspec": { 108 | "display_name": "Python 3", 109 | "language": "python", 110 | "name": "python3" 111 | }, 112 | "language_info": { 113 | "codemirror_mode": { 114 | "name": "ipython", 115 | "version": 3 116 | }, 117 | "file_extension": ".py", 118 | "mimetype": "text/x-python", 119 | "name": "python", 120 | "nbconvert_exporter": "python", 121 | "pygments_lexer": "ipython3", 122 | "version": "3.8.8" 123 | }, 124 | "toc": { 125 | "base_numbering": 1, 126 | "nav_menu": {}, 127 | "number_sections": true, 128 | "sideBar": true, 129 | "skip_h1_title": false, 130 | "title_cell": "Table of Contents", 131 | "title_sidebar": "Contents", 132 | "toc_cell": false, 133 | "toc_position": {}, 134 | "toc_section_display": true, 135 | "toc_window_display": false 136 | }, 137 | "varInspector": { 138 | "cols": { 139 | "lenName": 16, 140 | "lenType": 16, 141 | "lenVar": 40 142 | }, 143 | "kernels_config": { 144 | "python": { 145 | "delete_cmd_postfix": "", 146 | "delete_cmd_prefix": "del ", 147 | "library": "var_list.py", 148 | "varRefreshCmd": "print(var_dic_list())" 149 | }, 150 | "r": { 151 | "delete_cmd_postfix": ") ", 152 | "delete_cmd_prefix": "rm(", 153 | "library": "var_list.r", 154 | "varRefreshCmd": "cat(var_dic_list()) " 155 | } 156 | }, 157 | "types_to_exclude": [ 158 | "module", 159 | "function", 160 | "builtin_function_or_method", 161 | "instance", 162 | "_Feature" 163 | ], 164 | "window_display": false 165 | } 166 | }, 167 | "nbformat": 4, 168 | "nbformat_minor": 2 169 | } 170 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/063_Python_tuple()_Function.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/04_Python_Functions/tree/main/002_Python_Functions_Built_in)**\n", 9 | "" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "# Python `tuple()`\n", 17 | "\n", 18 | "The **`tuple()`** builtin can be used to create tuples in Python.\n", 19 | "\n", 20 | "In Python, a tuple is an immutable sequence type. One of the ways of creating tuple is by using the **`tuple()`** construct.\n", 21 | "\n", 22 | "**Syntax**:\n", 23 | "\n", 24 | "```python\n", 25 | "tuple(iterable)\n", 26 | "```" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "## `tuple()` Parameters\n", 34 | "\n", 35 | "* **iterable (optional)** - an iterable (list, range, etc.) or an iterator object\n", 36 | "\n", 37 | "If the **`iterable`** is not passed to **`tuple()`**, the function returns an empty tuple." 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": 1, 43 | "metadata": { 44 | "ExecuteTime": { 45 | "end_time": "2021-06-14T11:39:05.140738Z", 46 | "start_time": "2021-06-14T11:39:05.117303Z" 47 | }, 48 | "scrolled": false 49 | }, 50 | "outputs": [ 51 | { 52 | "name": "stdout", 53 | "output_type": "stream", 54 | "text": [ 55 | "t1 = ()\n", 56 | "t2 = (1, 4, 6)\n", 57 | "t1 = ('P', 'y', 't', 'h', 'o', 'n')\n", 58 | "t1 = (1, 2)\n" 59 | ] 60 | } 61 | ], 62 | "source": [ 63 | "# Example 1: Create tuples using tuple()\n", 64 | "\n", 65 | "t1 = tuple()\n", 66 | "print('t1 =', t1)\n", 67 | "\n", 68 | "# creating a tuple from a list\n", 69 | "t2 = tuple([1, 4, 6])\n", 70 | "print('t2 =', t2)\n", 71 | "\n", 72 | "# creating a tuple from a string\n", 73 | "t1 = tuple('Python')\n", 74 | "print('t1 =',t1)\n", 75 | "\n", 76 | "# creating a tuple from a dictionary\n", 77 | "t1 = tuple({1: 'one', 2: 'two'})\n", 78 | "print('t1 =',t1)" 79 | ] 80 | }, 81 | { 82 | "cell_type": "markdown", 83 | "metadata": {}, 84 | "source": [ 85 | "Recommended reading: **[Python Tuples](https://github.com/milaan9/02_Python_Datatypes/blob/main/004_Python_Tuple.ipynb)**" 86 | ] 87 | }, 88 | { 89 | "cell_type": "code", 90 | "execution_count": null, 91 | "metadata": {}, 92 | "outputs": [], 93 | "source": [] 94 | } 95 | ], 96 | "metadata": { 97 | "hide_input": false, 98 | "kernelspec": { 99 | "display_name": "Python 3", 100 | "language": "python", 101 | "name": "python3" 102 | }, 103 | "language_info": { 104 | "codemirror_mode": { 105 | "name": "ipython", 106 | "version": 3 107 | }, 108 | "file_extension": ".py", 109 | "mimetype": "text/x-python", 110 | "name": "python", 111 | "nbconvert_exporter": "python", 112 | "pygments_lexer": "ipython3", 113 | "version": "3.8.8" 114 | }, 115 | "toc": { 116 | "base_numbering": 1, 117 | "nav_menu": {}, 118 | "number_sections": true, 119 | "sideBar": true, 120 | "skip_h1_title": false, 121 | "title_cell": "Table of Contents", 122 | "title_sidebar": "Contents", 123 | "toc_cell": false, 124 | "toc_position": {}, 125 | "toc_section_display": true, 126 | "toc_window_display": false 127 | }, 128 | "varInspector": { 129 | "cols": { 130 | "lenName": 16, 131 | "lenType": 16, 132 | "lenVar": 40 133 | }, 134 | "kernels_config": { 135 | "python": { 136 | "delete_cmd_postfix": "", 137 | "delete_cmd_prefix": "del ", 138 | "library": "var_list.py", 139 | "varRefreshCmd": "print(var_dic_list())" 140 | }, 141 | "r": { 142 | "delete_cmd_postfix": ") ", 143 | "delete_cmd_prefix": "rm(", 144 | "library": "var_list.r", 145 | "varRefreshCmd": "cat(var_dic_list()) " 146 | } 147 | }, 148 | "types_to_exclude": [ 149 | "module", 150 | "function", 151 | "builtin_function_or_method", 152 | "instance", 153 | "_Feature" 154 | ], 155 | "window_display": false 156 | } 157 | }, 158 | "nbformat": 4, 159 | "nbformat_minor": 2 160 | } 161 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/README.md: -------------------------------------------------------------------------------- 1 |

2 | Last Commit 3 | 4 |

5 | 6 | 7 | 8 | # Python Built-in Functions 9 | 10 | In this class, you'll learn about python built-in functions. 11 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/README.txt: -------------------------------------------------------------------------------- 1 | Hello World! -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/img/r1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Functions/002_Python_Functions_Built_in/img/r1.png -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/img/r2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Functions/002_Python_Functions_Built_in/img/r2.png -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/python.txt: -------------------------------------------------------------------------------- 1 | Pretty cool, huh! 2 | -------------------------------------------------------------------------------- /Functions/002_Python_Functions_Built_in/test.txt: -------------------------------------------------------------------------------- 1 | Hello World! -------------------------------------------------------------------------------- /Functions/Problem_Function.md: -------------------------------------------------------------------------------- 1 | # Exercise 1: Define a function that accepts 2 values and return its sum, subtraction and multiplication. 2 | 3 | 4 | ## Hint 5 | Input: 6 | Enter value of a = 7 7 | Enter value of b = 5 8 | 9 | 10 | ## Expected output 11 | 12 | | Operation | Result | 13 | |-------------------|--------| 14 | | Sum | 12 | 15 | | Subtraction | 2 | 16 | | Multiplication | 35 | 17 | 18 | 19 | # solution 20 | ```python 21 | def result(a, b): 22 | sum = a+b 23 | sub = a-b 24 | mul = a*b 25 | print(f"Sum is {sum}, Sub is {sub}, & Multiply is {mul}") 26 | 27 | a = int(input("Enter value of a: ")) # 7 28 | b = int(input("Enter value of b: ")) # 5 29 | result(a,b) 30 | ``` 31 | # Exercise 2: Define a function that accepts roll number and returns whether the student is present or absent. 32 | 33 | ## Hint 34 | - Use a list to store sample roll. no. 35 | - Get input from a user and check if the number 36 | - exist in the list or not, if exists return present 37 | - else return absent 38 | 39 | ## solution 40 | ```python 41 | def detail(roll): 42 | x = [23,43,22,56] 43 | if roll in x: 44 | print(f"Roll number {roll} is present") 45 | else: 46 | print(f"Roll number {roll} is absent") 47 | roll = int(input("Enter roll no. ")) # 24 48 | detail(roll) 49 | 50 | # output 51 | # Roll number 24 is absent 52 | ``` 53 | 54 | 55 | # Exercise 3: Define a function in python that accepts 3 values and returns the maximum of three numbers. 56 | 57 | Hint 58 | Input: 59 | - Value of a = 30 60 | - Value of b = 22 61 | - value of c = 18 62 | 63 | Expected output 64 | - 30 is the maximum among all 65 | 66 | 67 | ## Sollution 68 | ```python 69 | def max(a, b, c): 70 | if a > b and a > c: 71 | print(f"{a} is maximum among all") 72 | elif b > a and b > c: 73 | print(f"{b} is maximum among all") 74 | else: 75 | print(f"{c} is maximum among all") 76 | 77 | max(30,22,18) 78 | ``` 79 | 80 | # Exercise 4: Define a function that accepts a number and returns whether the number is even or odd. 81 | 82 | Hint 83 | Input: 84 | - Enter a number = 4 85 | 86 | Expected output 87 | - 4 is an even number 88 | 89 | Hint 90 | Input: 91 | - Enter a number = 5 92 | 93 | Expected output 94 | - 4 is an odd number 95 | ## Solution 96 | ```python 97 | 98 | def func(x): 99 | if x % 2 == 0: 100 | print(f"{x} is Even number") 101 | else: 102 | print(f"{x} is Odd number") 103 | x = int(input("Enter a number ")) 104 | func(4) 105 | ``` 106 | # Exercise 5: Define a function which counts vowels and consonant in a word. 107 | Hint 108 | Input: 109 | - Enter a word = pythonlobby 110 | 111 | - Expected output 112 | - Count of vowel is = 2 113 | - Count of consonant is = 9 114 | 115 | ## Solution 116 | ```python 117 | 118 | def count(val): 119 | vov = 0 120 | con = 0 121 | for i in range(len(val)): 122 | if val[i] in ['a','e','i','o','u']: 123 | vov = vov+1 124 | else: 125 | con = con + 1 126 | 127 | print("Count of vowels is ",vov) 128 | print("Count of consonant is ",con) 129 | 130 | x = input("Enter Value: ") # pythonlobby 131 | count(x) 132 | ``` 133 | # Exercise 6: Define a function that returns Factorial of a number. 134 | Hint 135 | Input: 136 | - Enter a number = 6 137 | 138 | Expected output 139 | - Factorial is 720 140 | ```python 141 | 142 | # Solution 143 | def factorial(num): 144 | fact = 1 145 | while(num!=0): 146 | fact *= num 147 | num = num - 1 148 | print("Factorial is",fact) 149 | 150 | num = int(input("Enter number ")) 151 | factorial(num) 152 | ``` 153 | # Exercise 7: Define a function that accepts lowercase words and returns uppercase words. 154 | Hint 155 | Input: 156 | - Enter a word = pythonlobby 157 | 158 | Expected output 159 | - Result is = PYTHONLOBBY 160 | ```python 161 | 162 | # Solution 163 | def response(text): 164 | z = text.upper() 165 | print(z) 166 | 167 | text = input("Enter String: ") # pythonlobby 168 | response(text) 169 | ``` 170 | # 8. Write a program which can map() to make a list whose elements are cube of elements in a given list 171 | 172 | ```python 173 | 174 | def cube(lst): 175 | """ 176 | Returns the list of cubes of given number 177 | """ 178 | return list(map(lambda x: x**3, lst)) 179 | 180 | cube([1, 3, 5, 9, 15]) 181 | ``` 182 | 183 | 184 | # 9: Suggest Footwear 185 | # Write a program that will give suggested footwear based on the weather. 186 | # Ask the user for the weather outside with three options (sunny, rainy, or snowy) and give the correct footwear suggestion (sneaker, gumboot, or boots). Each # # # option should be written as its own function that prints a message based on the input. 187 | 188 | ```python 189 | 190 | def sunny(): 191 | print("It is sunny day, good to wear sneaker!") 192 | 193 | def rainy(): 194 | print("Oops! its raining, better wear gumbot") 195 | 196 | def snowy(): 197 | print("Wow! its snowing, better wear boot") 198 | 199 | weather_today = input("Whats the weather today:") 200 | if weather_today == "sunny": 201 | sunny() 202 | elif weather_today == "rainy": 203 | rainy() 204 | elif weather_today == "snowy": 205 | snowy() 206 | else: 207 | print(f"No footwear avaibale for {weather_today}") 208 | 209 | ``` 210 | 211 | # My Favorite Book 212 | # Write a function called favorite_book() that accepts two parameter, title and author. The function should print a message, such as The History of Bhutan by Karma # Phuntsho. Call the function, make sure to include a book title and author as an argument in the function call. 213 | 214 | ```python 215 | 216 | def favorite_book(title, author): 217 | print(f"{title} was written by {author}") 218 | favorite_book("The History of Bhutan", "Karma Phuntsho") 219 | ``` 220 | https://colab.research.google.com/github/Tanu-N-Prabhu/Python/blob/master/Python_Lambda_Function.ipynb 221 | -------------------------------------------------------------------------------- /Functions/img/anaconda_prompt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Functions/img/anaconda_prompt.png -------------------------------------------------------------------------------- /Functions/img/dnld_rep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Functions/img/dnld_rep.png -------------------------------------------------------------------------------- /Functions/img/f1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Functions/img/f1.png -------------------------------------------------------------------------------- /Functions/img/f2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Functions/img/f2.png -------------------------------------------------------------------------------- /Functions/img/fun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Functions/img/fun.png -------------------------------------------------------------------------------- /Functions/img/pack1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Functions/img/pack1.png -------------------------------------------------------------------------------- /Functions/img/re1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Functions/img/re1.png -------------------------------------------------------------------------------- /Functions/img/re2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Functions/img/re2.png -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/197375.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/197375.png -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/197375.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/197408.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/197408.png -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/197408.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/197484.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/197484.png -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/197571.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/197571.png -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/3898082.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/3898082.png -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/3909444.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/3909444.png -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/Developer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/Developer.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/Earth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/Earth.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/Handshake.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/Handshake.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/Neo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/Neo.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/blob-sunglasses.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/blob-sunglasses.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/build_readme.py: -------------------------------------------------------------------------------- 1 | import feedparser 2 | import httpx 3 | import pathlib 4 | import re 5 | import os 6 | import requests 7 | import git 8 | 9 | root = pathlib.Path(__file__).parent.resolve() 10 | 11 | def replace_chunk(content, marker, chunk, inline=False): 12 | r = re.compile( 13 | r".*".format(marker, marker), 14 | re.DOTALL, 15 | ) 16 | if not inline: 17 | chunk = "\n{}\n".format(chunk) 18 | chunk = "{}".format(marker, chunk, marker) 19 | return r.sub(chunk, content) 20 | 21 | def get_tils(): 22 | til_readme = "https://raw.githubusercontent.com/milaan9/TIL/master/README.md" 23 | r = requests.get(til_readme) 24 | 25 | page = requests.get(til_readme) 26 | all_text = page.text 27 | search_re = re.findall( r'(\*+).(\[.*?\])(\(.*?\)).?-(.+)', all_text, re.M|re.I) 28 | dt_til = sorted(search_re, key=lambda search_re: search_re[3], reverse=True)[:3] 29 | 30 | til_md = "" 31 | 32 | for i in dt_til: 33 | til_md += "\n" + i[0] + ' ' + i[1] + i[2] 34 | 35 | return til_md 36 | 37 | def fetch_blog_entries(): 38 | entries = feedparser.parse("https://milaan9.github.io/blog/feed.xml")["entries"] 39 | return [ 40 | { 41 | "title": entry["title"], 42 | "url": entry["link"].split("#")[0], 43 | "published": entry["published"].split("T")[0], 44 | } 45 | for entry in entries 46 | ] 47 | 48 | 49 | if __name__ == "__main__": 50 | 51 | readme = root / "README.md" 52 | readme_contents = readme.open().read() 53 | 54 | entries = fetch_blog_entries()[:3] 55 | entries_md = "\n".join( 56 | # ["* [{title}]({url}) - {published}".format(**entry) for entry in entries] 57 | ["* [{title}]({url})".format(**entry) for entry in entries] 58 | ) 59 | rewritten = replace_chunk(readme_contents, "blog", entries_md) 60 | 61 | til_readme_contents = get_tils() 62 | rewritten = replace_chunk(rewritten, "tils", til_readme_contents) 63 | 64 | readme.open("w").write(rewritten) 65 | -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/catfly.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/catfly.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/colaborate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/colaborate.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/corona.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/corona.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/doubt.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/doubt.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/flaticons.txt: -------------------------------------------------------------------------------- 1 | .svg 2 | EN: 3 | CN: https://image.flaticon.com/icons/svg/197/197375.svg 4 | IN: https://image.flaticon.com/icons/svg/3909/3909444.svg 5 | RU: https://image.flaticon.com/icons/svg/197/197408.svg 6 | GE: https://image.flaticon.com/icons/svg/197/197571.svg 7 | 8 | .gif 9 | Earth: https://github.com/TheDudeThatCode/TheDudeThatCode/blob/master/Assets/Earth.gif 10 | Developer: https://github.com/TheDudeThatCode/TheDudeThatCode/blob/master/Assets/Developer.gif 11 | Coronavirus: 12 | https://github.com/vinitshahdeo/COVID19/blob/master/img/corona.gif 13 | Letterbox: 14 | https://github.com/SP-XD/SP-XD/blob/main/images/letterbox.gif 15 | Lightening: 16 | https://github.com/SP-XD/SP-XD/blob/main/images/lightning.gif 17 | Message: 18 | https://github.com/SP-XD/SP-XD/blob/main/images/message.gif 19 | Hyperkitty: 20 | https://github.com/SP-XD/SP-XD/blob/main/images/hyperkitty.gif 21 | Sunglasses: 22 | https://emojis.slackmojis.com/emojis/images/1531849430/4246/blob-sunglasses.gif?1531849430 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/hello.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/hello.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/hyperkitty.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/hyperkitty.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/letterbox.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/letterbox.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/lightning.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/lightning.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/message.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/message.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/requirements.txt: -------------------------------------------------------------------------------- 1 | python-graphql-client==0.3.0 2 | httpx 3 | feedparser 4 | GitPython 5 | sqlite-utils 6 | -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/wink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/wink.gif -------------------------------------------------------------------------------- /Gurupatil0003-main/Gurupatil0003-main/write.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Gurupatil0003-main/Gurupatil0003-main/write.gif -------------------------------------------------------------------------------- /Impact Training Schedule (2024-25) (UPDATED).xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Impact Training Schedule (2024-25) (UPDATED).xlsx -------------------------------------------------------------------------------- /Lab - PYTHON FULL STACK.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Lab - PYTHON FULL STACK.pdf -------------------------------------------------------------------------------- /Lab_files/Lab.md: -------------------------------------------------------------------------------- 1 | ~~~python 2 | import random 3 | import string 4 | 5 | print("Random Password Generator") 6 | length = int(input("Enter the desired length for the password: ")) 7 | if length > 0: 8 | characters = string.ascii_letters + string.digits + string.punctuation 9 | password = "" 10 | for _ in range(length): 11 | password += random.choice(characters) 12 | print(f"Generated Password: {password}") 13 | else: 14 | print("Invalid password length. Please enter a positive integer.") 15 | ~~~ 16 | 17 | ~~~python 18 | 19 | import pandas as pd 20 | 21 | # Define a function to display the entire table (DataFrame) from the CSV file 22 | def display_table(file_path): 23 | # Read the CSV file into a DataFrame 24 | df = pd.read_csv(file_path) 25 | 26 | # Display the entire DataFrame (table) 27 | print("The entire table:") 28 | print(df) 29 | 30 | # Example usage 31 | file_path = "your_file.csv" # Replace with the path to your CSV file 32 | display_table(file_path) 33 | 34 | ~~~ 35 | 36 | ~~~python 37 | import pandas as pd 38 | 39 | # Define a function to calculate the mean of a specified column 40 | def calculate_mean(file_path, column_name): 41 | # Read the CSV file into a DataFrame 42 | df = pd.read_csv(file_path) 43 | 44 | # Check if the column exists in the DataFrame 45 | if column_name in df.columns: 46 | # Calculate and return the mean of the specified column 47 | return df[column_name].mean() 48 | else: 49 | # Return a message if the column doesn't exist 50 | return f"Column '{column_name}' not found in the file." 51 | 52 | # Example usage 53 | file_path = "your_file.csv" # Replace with the path to your CSV file 54 | column_name = "Specified column" # Replace with your column name 55 | mean_value = calculate_mean(file_path, column_name) 56 | 57 | print(mean_value) 58 | 59 | ~~~ 60 | 61 | ```python 62 | class Person: 63 | def __init__(self, name, role, detail): 64 | self.name = name 65 | self.role = role 66 | self.detail = detail 67 | 68 | def get_details(self): 69 | return f"{self.role} Name: {self.name}, {self.detail}" 70 | 71 | class Course: 72 | def __init__(self, name, teacher): 73 | self.name = name 74 | self.teacher = teacher 75 | self.students = [] 76 | 77 | def enroll_student(self, student): 78 | self.students.append(student) 79 | 80 | def list_students(self): 81 | return [student.name for student in self.students] 82 | 83 | # Example usage: 84 | student = Person("John", "Student", "Grade: 10") 85 | teacher = Person("Guru Sir", "Teacher", "Subject: Python") 86 | 87 | course = Course("Python Programming", teacher) 88 | course.enroll_student(student) 89 | 90 | # Print details 91 | print(student.get_details()) 92 | print(f"Enrolled in {course.name} taught by {teacher.name}") 93 | 94 | 95 | 96 | ``` 97 | -------------------------------------------------------------------------------- /Lab_files/employee_data_large.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Lab_files/employee_data_large.xlsx -------------------------------------------------------------------------------- /Lab_files/example_data.csv: -------------------------------------------------------------------------------- 1 | Name,Age,Salary 2 | Alice,30,50000 3 | Bob,25,55000 4 | Charlie,35,60000 5 | Diana,28,48000 6 | -------------------------------------------------------------------------------- /Modules and Packages/Matplot.md: -------------------------------------------------------------------------------- 1 | ```python 2 | import matplotlib.pyplot as plt 3 | 4 | # Data 5 | x = [1, 2, 3, 4] 6 | y = [1, 4, 9, 16] 7 | 8 | # Plot 9 | plt.plot(x, y) 10 | plt.show() # Display the plot 11 | ``` 12 | 13 | ```python 14 | import matplotlib.pyplot as plt 15 | 16 | # Data 17 | x = [1, 2, 3, 4] 18 | y = [1, 4, 9, 16] 19 | 20 | # Create figure and axes 21 | fig, ax = plt.subplots() 22 | 23 | # Plot on the axes 24 | ax.plot(x, y) 25 | 26 | # Customize the plot 27 | ax.set_title('My Plot') 28 | ax.set_xlabel('X-axis') 29 | ax.set_ylabel('Y-axis') 30 | 31 | # Display the plot 32 | plt.show() 33 | 34 | 35 | ``` 36 | 37 | ```python 38 | import matplotlib.pyplot as plt 39 | 40 | # Data 41 | x = [1, 2, 3, 4] 42 | y = [1, 4, 9, 16] 43 | 44 | # Plot with customized line style and color 45 | plt.plot(x, y, linestyle='--', color='r') # Red dashed line 46 | plt.title('Styled Line Plot') 47 | plt.show() 48 | 49 | ``` 50 | 51 | ```python 52 | import matplotlib.pyplot as plt 53 | 54 | # Data 55 | x = [1, 2, 3, 4] 56 | y = [1, 4, 9, 16] 57 | 58 | # Scatter plot with customization 59 | plt.scatter(x, y, color='b', marker='o') # Blue circles 60 | plt.title('Scatter Plot') 61 | plt.show() 62 | 63 | ``` 64 | 65 | ```python 66 | 67 | import matplotlib.pyplot as plt 68 | 69 | # Data 70 | categories = ['A', 'B', 'C'] 71 | values = [10, 15, 7] 72 | 73 | # Bar plot 74 | plt.bar(categories, values, color=['red', 'green', 'blue']) 75 | plt.title('Bar Plot') 76 | plt.show() 77 | 78 | ``` 79 | 80 | ```python 81 | import matplotlib.pyplot as plt 82 | 83 | # Data 84 | x = [1, 2, 3, 4] 85 | y = [1, 4, 9, 16] 86 | 87 | # Create subplots (2 rows, 1 column) 88 | fig, axes = plt.subplots(2, 1) 89 | 90 | # Plot on first subplot 91 | axes[0].plot(x, y) 92 | axes[0].set_title('Line Plot') 93 | 94 | # Plot on second subplot 95 | axes[1].scatter(x, y) 96 | axes[1].set_title('Scatter Plot') 97 | 98 | # Display the plot 99 | plt.tight_layout() 100 | plt.show() 101 | 102 | ``` 103 | -------------------------------------------------------------------------------- /Modules and Packages/Ploty.md: -------------------------------------------------------------------------------- 1 | ```python 2 | import plotly.graph_objects as go 3 | 4 | # Data 5 | x = [1, 2, 3, 4] 6 | y = [1, 4, 9, 16] 7 | 8 | # Create line plot 9 | fig = go.Figure(data=go.Scatter(x=x, y=y, mode='lines')) 10 | 11 | # Customize layout 12 | fig.update_layout(title='Basic Line Plot', 13 | xaxis_title='X-axis', 14 | yaxis_title='Y-axis') 15 | 16 | # Show the plot 17 | fig.show() 18 | 19 | 20 | ``` 21 | 22 | -------------------------------------------------------------------------------- /Modules and Packages/numpy.md: -------------------------------------------------------------------------------- 1 | ## Numpay 2 | 3 | ### Basic Operation 4 | ```python 5 | # Importing the hypothetical numpay library 6 | import numpay as npy 7 | 8 | # Creating a sample array 9 | array = npy.array([1, 2, 3, 4, 5]) 10 | 11 | # Performing basic operations 12 | sum_array = npy.sum(array) 13 | mean_array = npy.mean(array) 14 | std_array = npy.std(array) 15 | 16 | print("Original Array:", array) 17 | print("Sum:", sum_array) 18 | print("Mean:", mean_array) 19 | print("Standard Deviation:", std_array) 20 | ``` 21 | 22 | ## Element-wise Operations 23 | 24 | ```python 25 | # Assuming array is already created 26 | # Performing element-wise operations 27 | squared_array = npy.square(array) 28 | 29 | print("Original Array:", array) 30 | print("Squared Array:", squared_array) 31 | ``` 32 | 33 | ### Creating a sample matrix 34 | ```python 35 | matrix = npy.array([[1, 2], [3, 4]]) 36 | 37 | # Transposing the matrix 38 | transposed_matrix = npy.transpose(matrix) 39 | 40 | print("Original Matrix:\n", matrix) 41 | print("Transposed Matrix:\n", transposed_matrix) 42 | ``` 43 | 44 | ### Array Arithmetic Operations 45 | 46 | ```python 47 | # Creating two sample arrays 48 | array1 = npy.array([1, 2, 3, 4, 5]) 49 | array2 = npy.array([5, 4, 3, 2, 1]) 50 | 51 | # Adding the arrays 52 | sum_arrays = npy.add(array1, array2) 53 | 54 | # Subtracting the arrays 55 | diff_arrays = npy.subtract(array1, array2) 56 | 57 | # Multiplying the arrays element-wise 58 | product_arrays = npy.multiply(array1, array2) 59 | 60 | # Dividing the arrays element-wise 61 | quotient_arrays = npy.divide(array1, array2) 62 | 63 | print("Array1:", array1) 64 | print("Array2:", array2) 65 | print("Sum:", sum_arrays) 66 | print("Difference:", diff_arrays) 67 | print("Product:", product_arrays) 68 | print("Quotient:", quotient_arrays) 69 | ``` 70 | ### Reshaping an Array 71 | 72 | ```python 73 | # Creating a sample array 74 | array = npy.array([1, 2, 3, 4, 5, 6]) 75 | 76 | # Reshaping the array into a 2x3 matrix 77 | reshaped_array = npy.reshape(array, (2, 3)) 78 | 79 | print("Original Array:", array) 80 | print("Reshaped Array:\n", reshaped_array) 81 | ``` 82 | ### Finding Maximum and Minimum Values 83 | ```python 84 | # Creating a sample array 85 | array = npy.array([1, 3, 2, 5, 4]) 86 | 87 | # Finding the maximum value 88 | max_value = npy.max(array) 89 | 90 | # Finding the minimum value 91 | min_value = npy.min(array) 92 | 93 | print("Array:", array) 94 | print("Maximum Value:", max_value) 95 | print("Minimum Value:", min_value) 96 | ``` 97 | 98 | ### Generating a Range of Numbers 99 | ```python 100 | # Generating a range of numbers from 0 to 9 101 | range_array = npy.arange(10) 102 | 103 | print("Range Array:", range_array) 104 | ``` 105 | 106 | -------------------------------------------------------------------------------- /Modules and Packages/seaborn.md: -------------------------------------------------------------------------------- 1 | # Seaborn 2 | 3 | 4 | ## scatterplot 5 | ```python 6 | import seaborn as sns 7 | import matplotlib.pyplot as plt 8 | 9 | # Lists of values 10 | x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 11 | y = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] 12 | 13 | # Creating a scatter plot 14 | sns.scatterplot(x=x, y=y) 15 | 16 | # Displaying the plot 17 | plt.show() 18 | 19 | ``` 20 | ### histplot 21 | ```python 22 | import seaborn as sns 23 | import matplotlib.pyplot as plt 24 | 25 | # List of values 26 | data = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5] 27 | 28 | # Creating a histogram 29 | sns.histplot(data, kde=True) 30 | 31 | # Displaying the plot 32 | plt.show() 33 | ``` 34 | 35 | ### Box plot 36 | ```python 37 | import seaborn as sns 38 | import matplotlib.pyplot as plt 39 | import pandas as pd 40 | 41 | # Lists of values for multiple categories 42 | A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 43 | B = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] 44 | C = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12] 45 | D = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13] 46 | 47 | # Creating a DataFrame from the data 48 | df = pd.DataFrame({'A': A, 'B': B, 'C': C, 'D': D}) 49 | 50 | # Creating a box plot 51 | sns.boxplot(data=df) 52 | 53 | # Displaying the plot 54 | plt.show() 55 | ``` 56 | ### Line Plot 57 | 58 | ```python 59 | import seaborn as sns 60 | import matplotlib.pyplot as plt 61 | 62 | # Lists of values 63 | x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 64 | y = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] 65 | 66 | # Creating a line plot 67 | sns.lineplot(x=x, y=y) 68 | 69 | # Displaying the plot 70 | plt.show() 71 | ``` 72 | ### Pair plot 73 | ```python 74 | import seaborn as sns 75 | import matplotlib.pyplot as plt 76 | import pandas as pd 77 | 78 | # Lists of values 79 | A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 80 | B = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] 81 | C = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12] 82 | D = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13] 83 | 84 | # Creating a DataFrame from the data 85 | df = pd.DataFrame({'A': A, 'B': B, 'C': C, 'D': D}) 86 | 87 | # Creating a pair plot 88 | sns.pairplot(df) 89 | 90 | # Displaying the plot 91 | plt.show() 92 | 93 | 94 | ``` 95 | -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/MRO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/MRO.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/OOPAbstraction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/OOPAbstraction.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/OOPClass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/OOPClass.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/OOPConcepts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/OOPConcepts.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/OOPEncapsulation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/OOPEncapsulation.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/OOPInheritance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/OOPInheritance.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/OOPObject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/OOPObject.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/OOPPolymorphism.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/OOPPolymorphism.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/OOPStructre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/OOPStructre.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/classobj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/classobj.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/dnld_rep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/dnld_rep.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/encap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/encap.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/encapsulation_python_class.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/encapsulation_python_class.jpg -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/hbi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/hbi.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/hi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/hi.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/i.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/i.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/instvarmeth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/instvarmeth.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/mli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/mli.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/mo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/mo.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/mpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/mpi.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/objr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/objr.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/polymor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/polymor.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/python_data_hiding.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/python_data_hiding.jpg -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/imgs/si.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/imgs/si.png -------------------------------------------------------------------------------- /Object-Oriented-Programming-Concepts/imgs/python_data_hiding.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Object-Oriented-Programming-Concepts/imgs/python_data_hiding.jpg -------------------------------------------------------------------------------- /Operators_python/6. Membership Operators.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Python Operators" 8 | ] 9 | }, 10 | { 11 | "cell_type": "raw", 12 | "metadata": {}, 13 | "source": [ 14 | "The operator can be defined as a symbol which is responsible for a particular operation between two operands.\n", 15 | "\n", 16 | "Python Operators in general are used to perform operations on values and variables.\n", 17 | "\n", 18 | "Operators are the pillars of a program on which the logic is built in a specific programming language." 19 | ] 20 | }, 21 | { 22 | "cell_type": "raw", 23 | "metadata": {}, 24 | "source": [ 25 | "Python provides a variety of operators, which are described as follows.\n", 26 | "\n", 27 | "1. Arithmetic operators\n", 28 | "\n", 29 | "2. Comparison operators\n", 30 | "\n", 31 | "3. Assignment Operators\n", 32 | "\n", 33 | "4. Logical Operators\n", 34 | "\n", 35 | "5. Bitwise Operators\n", 36 | "\n", 37 | "6. Membership Operators\n", 38 | "\n", 39 | "7. Identity Operators\n", 40 | "\n", 41 | "8. Precedence and Associativity Operator\n", 42 | "\n", 43 | "9. Shift Operators\n", 44 | "\n", 45 | "10. Escape Operators" 46 | ] 47 | }, 48 | { 49 | "cell_type": "markdown", 50 | "metadata": {}, 51 | "source": [ 52 | "# Membership Operators" 53 | ] 54 | }, 55 | { 56 | "cell_type": "raw", 57 | "metadata": {}, 58 | "source": [ 59 | "in and not in are the membership operators; used to test whether a value or variable is in a sequence.\n", 60 | "\n", 61 | "Python membership operators are used to check the membership of value inside a Python data structure. If the value is present in the data structure, then the resulting value is true otherwise it returns false." 62 | ] 63 | }, 64 | { 65 | "cell_type": "raw", 66 | "metadata": {}, 67 | "source": [ 68 | "Operator\t Description\n", 69 | "\n", 70 | "in\t It is evaluated to be true if the first operand is found in the second operand (list, \n", 71 | " tuple, or dictionary).\n", 72 | "\n", 73 | "not in\t It is evaluated to be true if the first operand is not found in the second operand \n", 74 | " (list, tuple, or dictionary)." 75 | ] 76 | }, 77 | { 78 | "cell_type": "code", 79 | "execution_count": 3, 80 | "metadata": {}, 81 | "outputs": [ 82 | { 83 | "data": { 84 | "text/plain": [ 85 | "[2, 3, 4, 5, 6, 7, 8, 8]" 86 | ] 87 | }, 88 | "execution_count": 3, 89 | "metadata": {}, 90 | "output_type": "execute_result" 91 | } 92 | ], 93 | "source": [ 94 | "a=[2,3,4,5,6,7,8,8]\n", 95 | "a" 96 | ] 97 | }, 98 | { 99 | "cell_type": "code", 100 | "execution_count": 6, 101 | "metadata": {}, 102 | "outputs": [ 103 | { 104 | "data": { 105 | "text/plain": [ 106 | "True" 107 | ] 108 | }, 109 | "execution_count": 6, 110 | "metadata": {}, 111 | "output_type": "execute_result" 112 | } 113 | ], 114 | "source": [ 115 | "100 not in a" 116 | ] 117 | }, 118 | { 119 | "cell_type": "code", 120 | "execution_count": 5, 121 | "metadata": {}, 122 | "outputs": [ 123 | { 124 | "data": { 125 | "text/plain": [ 126 | "True" 127 | ] 128 | }, 129 | "execution_count": 5, 130 | "metadata": {}, 131 | "output_type": "execute_result" 132 | } 133 | ], 134 | "source": [ 135 | "5 in a" 136 | ] 137 | }, 138 | { 139 | "cell_type": "raw", 140 | "metadata": {}, 141 | "source": [ 142 | "in True if value is found in the sequence\n", 143 | "\n", 144 | "not in True if value is not found in the sequence" 145 | ] 146 | }, 147 | { 148 | "cell_type": "code", 149 | "execution_count": 1, 150 | "metadata": {}, 151 | "outputs": [ 152 | { 153 | "name": "stdout", 154 | "output_type": "stream", 155 | "text": [ 156 | "x is NOT present in given list\n", 157 | "y is present in given list\n" 158 | ] 159 | } 160 | ], 161 | "source": [ 162 | "\n", 163 | "# Python program to illustrate\n", 164 | "# not 'in' operator\n", 165 | "x = 24\n", 166 | "y = 20\n", 167 | "list = [10, 20, 30, 40, 50]\n", 168 | "\n", 169 | "if (x not in list):\n", 170 | "\tprint(\"x is NOT present in given list\")\n", 171 | "else:\n", 172 | "\tprint(\"x is present in given list\")\n", 173 | "\n", 174 | "if (y in list):\n", 175 | "\tprint(\"y is present in given list\")\n", 176 | "else:\n", 177 | "\tprint(\"y is NOT present in given list\")\n" 178 | ] 179 | }, 180 | { 181 | "cell_type": "code", 182 | "execution_count": null, 183 | "metadata": {}, 184 | "outputs": [], 185 | "source": [] 186 | } 187 | ], 188 | "metadata": { 189 | "kernelspec": { 190 | "display_name": "Python 3", 191 | "language": "python", 192 | "name": "python3" 193 | }, 194 | "language_info": { 195 | "codemirror_mode": { 196 | "name": "ipython", 197 | "version": 3 198 | }, 199 | "file_extension": ".py", 200 | "mimetype": "text/x-python", 201 | "name": "python", 202 | "nbconvert_exporter": "python", 203 | "pygments_lexer": "ipython3", 204 | "version": "3.8.5" 205 | } 206 | }, 207 | "nbformat": 4, 208 | "nbformat_minor": 4 209 | } 210 | -------------------------------------------------------------------------------- /Operators_python/7. Identity Operators.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Python Operators" 8 | ] 9 | }, 10 | { 11 | "cell_type": "raw", 12 | "metadata": {}, 13 | "source": [ 14 | "The operator can be defined as a symbol which is responsible for a particular operation between two operands.\n", 15 | "\n", 16 | "Python Operators in general are used to perform operations on values and variables.\n", 17 | "\n", 18 | "Operators are the pillars of a program on which the logic is built in a specific programming language." 19 | ] 20 | }, 21 | { 22 | "cell_type": "raw", 23 | "metadata": {}, 24 | "source": [ 25 | "Python provides a variety of operators, which are described as follows.\n", 26 | "\n", 27 | "1. Arithmetic operators\n", 28 | "\n", 29 | "2. Comparison operators\n", 30 | "\n", 31 | "3. Assignment Operators\n", 32 | "\n", 33 | "4. Logical Operators\n", 34 | "\n", 35 | "5. Bitwise Operators\n", 36 | "\n", 37 | "6. Membership Operators\n", 38 | "\n", 39 | "7. Identity Operators\n", 40 | "\n", 41 | "8. Precedence and Associativity Operator\n", 42 | "\n", 43 | "9. Shift Operators\n", 44 | "\n", 45 | "10. Escape Operators" 46 | ] 47 | }, 48 | { 49 | "cell_type": "markdown", 50 | "metadata": {}, 51 | "source": [ 52 | "# Identity Operators" 53 | ] 54 | }, 55 | { 56 | "cell_type": "raw", 57 | "metadata": {}, 58 | "source": [ 59 | "is and is not are the identity operators both are used to check if two values are located on the same part of the memory.\n", 60 | "\n", 61 | "The identity operators are used to decide whether an element certain class or type.\n", 62 | "\n", 63 | "Two variables that are equal do not imply that they are identical. " 64 | ] 65 | }, 66 | { 67 | "cell_type": "raw", 68 | "metadata": {}, 69 | "source": [ 70 | " \n", 71 | "Operator\t Description\n", 72 | "\n", 73 | "is\t It is evaluated to be true if the reference present at both sides point to the same \n", 74 | " object.\n", 75 | "\n", 76 | "\n", 77 | "is not\t It is evaluated to be true if the reference present at both sides do not point to the \n", 78 | " same object." 79 | ] 80 | }, 81 | { 82 | "cell_type": "raw", 83 | "metadata": {}, 84 | "source": [ 85 | "is True if the operands are identical \n", 86 | "\n", 87 | "is not True if the operands are not identical \n" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": 1, 93 | "metadata": {}, 94 | "outputs": [ 95 | { 96 | "name": "stdout", 97 | "output_type": "stream", 98 | "text": [ 99 | "True\n", 100 | "True\n" 101 | ] 102 | } 103 | ], 104 | "source": [ 105 | "a = 10\n", 106 | "b = 20\n", 107 | "c = a\n", 108 | "\n", 109 | "print(a is not b)\n", 110 | "print(a is c)\n" 111 | ] 112 | }, 113 | { 114 | "cell_type": "code", 115 | "execution_count": 6, 116 | "metadata": {}, 117 | "outputs": [ 118 | { 119 | "name": "stderr", 120 | "output_type": "stream", 121 | "text": [ 122 | "<>:1: SyntaxWarning: \"is not\" with a literal. Did you mean \"!=\"?\n", 123 | "<>:1: SyntaxWarning: \"is not\" with a literal. Did you mean \"!=\"?\n", 124 | ":1: SyntaxWarning: \"is not\" with a literal. Did you mean \"!=\"?\n", 125 | " 10 is not 20\n" 126 | ] 127 | }, 128 | { 129 | "data": { 130 | "text/plain": [ 131 | "True" 132 | ] 133 | }, 134 | "execution_count": 6, 135 | "metadata": {}, 136 | "output_type": "execute_result" 137 | } 138 | ], 139 | "source": [ 140 | "10 is not 20" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": null, 146 | "metadata": {}, 147 | "outputs": [], 148 | "source": [] 149 | } 150 | ], 151 | "metadata": { 152 | "kernelspec": { 153 | "display_name": "Python 3", 154 | "language": "python", 155 | "name": "python3" 156 | }, 157 | "language_info": { 158 | "codemirror_mode": { 159 | "name": "ipython", 160 | "version": 3 161 | }, 162 | "file_extension": ".py", 163 | "mimetype": "text/x-python", 164 | "name": "python", 165 | "nbconvert_exporter": "python", 166 | "pygments_lexer": "ipython3", 167 | "version": "3.8.5" 168 | } 169 | }, 170 | "nbformat": 4, 171 | "nbformat_minor": 4 172 | } 173 | -------------------------------------------------------------------------------- /Programming_Fundamentals_Impact_Lesson_Plan (1) (1).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/Programming_Fundamentals_Impact_Lesson_Plan (1) (1).pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Assignment For Student 2 | ## 1. Assignment 1 3 | 4 | |Sl No|Project Name| 5 | |---|---| 6 | |1|Create ur Own Portfolio| 7 | 8 | Hint:-Use Flask Frame Work With Python 9 | 10 | ## 2. Assignment 2 11 | |Roll Numbers|Project Name| 12 | |---|---| 13 | |1|Blogging platform| 14 | |2|To-do list application| 15 | |3|Recipe sharing website| 16 | |4|Job board for internships| 17 | |5|E-commerce store for digital products| 18 | |6|Portfolio website| 19 | |7|Debate platform for students| 20 | |8|Local business directory| 21 | |9|Task-based team collaboration platform| 22 | |10|Online book store| 23 | |11|Voting/polling application| 24 | |12|Contact manager| 25 | |13|Issue tracker| 26 | |14|News aggregator| 27 | |15|Photo gallery| 28 | |16|Time tracking application| 29 | |17|Blogging platform with Markdown support| 30 | |18|Quiz application with timed questions| 31 | |19|Hotel booking system| 32 | |20|Podcast streaming platform| 33 | |21|Budget planner| 34 | |22|Task scheduler| 35 | |23|Travel itinerary planner| 36 | |24|Book Recommendation System| 37 | |25|Movie Recommendation System| 38 | |26|StudyAssistant| 39 | |27|StudentHub| 40 | |28|CampusConnect|n 41 | |29|StudyGroup| 42 | |30|StudyAssistant| 43 | |31|StudyPlanner| 44 | |32|CampusPortal| 45 | |33|CampusEvents| 46 | |34|CampusBulletin| 47 | |35|CampusGather| 48 | |36|Chat Application| 49 | |37|Social Media Platform| 50 | |38|Weather Application| 51 | |39|Quiz App| 52 | |40|File Upload and Sharing| 53 | |41|Event Management System| 54 | |42|Online Voting System| 55 | |43|Expense Tracker| 56 | |44|Stock Portfolio Tracker| 57 | |45|Online Markdown Editor| 58 | |46|Online Learning Platform| 59 | |47|Feedback Collection System| 60 | |48|Music Streaming Platform| 61 | |49|Job Application Tracker| 62 | |50|Creative Writing Community| 63 | |51|Group Project Collaboration Tool| 64 | |52|Tutoring and Academic Support Platform| 65 | |53|Fitness Challenge Platform| 66 | |54|Language Exchange Platform| 67 | |55|Job Application Tracker| 68 | |56|Fitness Tracker| 69 | |57|Language Learning Platform| 70 | |58|Volunteer Management System| 71 | |59|Meditation and Mindfulness App| 72 | |60|Nutrition and Meal Planning App| 73 | |61|Campus Transportation Tracker| 74 | |62|Social Networking Platform for Academics| 75 | |63|Campus Lost and Found System| 76 | |64|Freelance Gig Marketplace| 77 | |65|Mental Health Support Community| 78 | |66|Personal Development Planner| 79 | |67|Sustainable Living Tips Platform| 80 | |68|Study Abroad Exchange Network| 81 | |69|Tutoring and Academic Support Platform| 82 | |70|Fitness Challenge Platform| 83 | |71|Language Exchange Platform| 84 | |72|Personal Development Planner| 85 | -------------------------------------------------------------------------------- /http Methods_in_Flask/Templates/df.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | GET Example 7 | 8 | 9 |

GET Example

10 |
11 | 12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /http Methods_in_Flask/Templates/l.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | POST Example 7 | 8 | 9 |

POST Example

10 |

Data received: {{ data }}

11 | 12 | 13 | -------------------------------------------------------------------------------- /http Methods_in_Flask/a.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request, render_template 2 | 3 | app = Flask(__name__) 4 | 5 | @app.route('/example', methods=['GET', 'POST']) 6 | def example(): 7 | if request.method == 'GET': 8 | return render_template('df.html') 9 | elif request.method == 'POST': 10 | return render_template('l.html', data=request.form['data']) 11 | else: 12 | return 'Unsupported HTTP method.' 13 | 14 | if __name__ == '__main__': 15 | app.run(debug=True) 16 | -------------------------------------------------------------------------------- /img/A1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/A1.png -------------------------------------------------------------------------------- /img/A2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/A2.png -------------------------------------------------------------------------------- /img/A3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/A3.png -------------------------------------------------------------------------------- /img/A4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/A4.png -------------------------------------------------------------------------------- /img/A5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/A5.png -------------------------------------------------------------------------------- /img/A6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/A6.png -------------------------------------------------------------------------------- /img/A7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/A7.png -------------------------------------------------------------------------------- /img/A8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/A8.png -------------------------------------------------------------------------------- /img/IvsC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/IvsC.png -------------------------------------------------------------------------------- /img/c1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/c1.png -------------------------------------------------------------------------------- /img/c2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/c2.png -------------------------------------------------------------------------------- /img/c3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/c3.png -------------------------------------------------------------------------------- /img/c4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/c4.png -------------------------------------------------------------------------------- /img/dnld_rep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/dnld_rep.png -------------------------------------------------------------------------------- /img/format1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/format1.png -------------------------------------------------------------------------------- /img/format2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/format2.png -------------------------------------------------------------------------------- /img/h1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/h1.png -------------------------------------------------------------------------------- /img/h2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/h2.png -------------------------------------------------------------------------------- /img/i1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/i1.png -------------------------------------------------------------------------------- /img/i2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/i2.png -------------------------------------------------------------------------------- /img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/icon.png -------------------------------------------------------------------------------- /img/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/icon48.png -------------------------------------------------------------------------------- /img/ind1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/ind1.png -------------------------------------------------------------------------------- /img/ind2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/ind2.png -------------------------------------------------------------------------------- /img/jupyter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/jupyter.png -------------------------------------------------------------------------------- /img/k1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/k1.png -------------------------------------------------------------------------------- /img/k2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/k2.png -------------------------------------------------------------------------------- /img/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/left.png -------------------------------------------------------------------------------- /img/li0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li0.png -------------------------------------------------------------------------------- /img/li1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li1.png -------------------------------------------------------------------------------- /img/li10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li10.png -------------------------------------------------------------------------------- /img/li2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li2.png -------------------------------------------------------------------------------- /img/li3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li3.png -------------------------------------------------------------------------------- /img/li4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li4.png -------------------------------------------------------------------------------- /img/li5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li5.png -------------------------------------------------------------------------------- /img/li6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li6.png -------------------------------------------------------------------------------- /img/li7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li7.png -------------------------------------------------------------------------------- /img/li8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li8.png -------------------------------------------------------------------------------- /img/li9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/li9.png -------------------------------------------------------------------------------- /img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/logo.png -------------------------------------------------------------------------------- /img/ns1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/ns1.png -------------------------------------------------------------------------------- /img/ns2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/ns2.png -------------------------------------------------------------------------------- /img/op1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op1.png -------------------------------------------------------------------------------- /img/op10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op10.png -------------------------------------------------------------------------------- /img/op11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op11.png -------------------------------------------------------------------------------- /img/op12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op12.png -------------------------------------------------------------------------------- /img/op13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op13.png -------------------------------------------------------------------------------- /img/op14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op14.png -------------------------------------------------------------------------------- /img/op2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op2.png -------------------------------------------------------------------------------- /img/op3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op3.png -------------------------------------------------------------------------------- /img/op4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op4.png -------------------------------------------------------------------------------- /img/op5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op5.png -------------------------------------------------------------------------------- /img/op6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op6.png -------------------------------------------------------------------------------- /img/op7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op7.png -------------------------------------------------------------------------------- /img/op8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op8.png -------------------------------------------------------------------------------- /img/op9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/op9.png -------------------------------------------------------------------------------- /img/p1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/p1.png -------------------------------------------------------------------------------- /img/p2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/p2.png -------------------------------------------------------------------------------- /img/p3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/p3.png -------------------------------------------------------------------------------- /img/p4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/p4.png -------------------------------------------------------------------------------- /img/p5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/p5.png -------------------------------------------------------------------------------- /img/p6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/p6.png -------------------------------------------------------------------------------- /img/palette.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/palette.gif -------------------------------------------------------------------------------- /img/ps1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/ps1.png -------------------------------------------------------------------------------- /img/ps2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/ps2.png -------------------------------------------------------------------------------- /img/ps3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/ps3.png -------------------------------------------------------------------------------- /img/ps4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/ps4.png -------------------------------------------------------------------------------- /img/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/right.png -------------------------------------------------------------------------------- /img/setup1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/setup1.png -------------------------------------------------------------------------------- /img/setup2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/setup2.png -------------------------------------------------------------------------------- /img/setup3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/setup3.png -------------------------------------------------------------------------------- /img/setup4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/setup4.png -------------------------------------------------------------------------------- /img/v1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v1.png -------------------------------------------------------------------------------- /img/v10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v10.png -------------------------------------------------------------------------------- /img/v11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v11.png -------------------------------------------------------------------------------- /img/v12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v12.png -------------------------------------------------------------------------------- /img/v13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v13.png -------------------------------------------------------------------------------- /img/v14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v14.png -------------------------------------------------------------------------------- /img/v15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v15.png -------------------------------------------------------------------------------- /img/v16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v16.png -------------------------------------------------------------------------------- /img/v17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v17.png -------------------------------------------------------------------------------- /img/v18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v18.png -------------------------------------------------------------------------------- /img/v19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v19.png -------------------------------------------------------------------------------- /img/v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v2.png -------------------------------------------------------------------------------- /img/v20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v20.png -------------------------------------------------------------------------------- /img/v3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v3.png -------------------------------------------------------------------------------- /img/v4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v4.png -------------------------------------------------------------------------------- /img/v5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v5.png -------------------------------------------------------------------------------- /img/v6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v6.png -------------------------------------------------------------------------------- /img/v7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v7.png -------------------------------------------------------------------------------- /img/v8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v8.png -------------------------------------------------------------------------------- /img/v9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/v9.png -------------------------------------------------------------------------------- /img/youtube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/img/youtube.png -------------------------------------------------------------------------------- /python Handling Exception and Handling Files/img/background_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/python Handling Exception and Handling Files/img/background_01.jpg -------------------------------------------------------------------------------- /python Handling Exception and Handling Files/img/candies.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/python Handling Exception and Handling Files/img/candies.jpg -------------------------------------------------------------------------------- /python Handling Exception and Handling Files/img/house.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/python Handling Exception and Handling Files/img/house.jpg -------------------------------------------------------------------------------- /python Handling Exception and Handling Files/img/pexels-athena-1758144.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/python Handling Exception and Handling Files/img/pexels-athena-1758144.jpg -------------------------------------------------------------------------------- /python Handling Exception and Handling Files/img/pexels-konstantin-mishchenko-1926769.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/python Handling Exception and Handling Files/img/pexels-konstantin-mishchenko-1926769.jpg -------------------------------------------------------------------------------- /python Handling Exception and Handling Files/img/th (2).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/python Handling Exception and Handling Files/img/th (2).jpeg -------------------------------------------------------------------------------- /python Handling Exception and Handling Files/img/van_damme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/python Handling Exception and Handling Files/img/van_damme.png -------------------------------------------------------------------------------- /python Handling Exception and Handling Files/img/vandamme_house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gurupatil0003/Python_Tutorial/cd55f430770be47551c0f0c290178e5f7b09c3f1/python Handling Exception and Handling Files/img/vandamme_house.png --------------------------------------------------------------------------------