├── txt ├── task questions part 2.ipynb ├── questions.ipynb ├── 26th class solutions.ipynb ├── part 1 solutions.ipynb └── Python Decorators.ipynb /txt: -------------------------------------------------------------------------------- 1 | def get_password_strength(username,password): 2 | c=0 3 | capital='ABCDEFGHIJKLMNOPQRSTUVWXYZ' 4 | c_flag=False 5 | small='abcdefghijklmnopqrstuvwxyz' 6 | s_flag=False 7 | num='0123456789' 8 | n_flag=False 9 | nc_flag=True 10 | if username in password: 11 | print('password should not contain username') 12 | return 13 | if len(password)>7: 14 | c=c+1 15 | for i in range(len(password)): 16 | if password[i] in small: 17 | s_flag=True 18 | elif password[i] in capital: 19 | c_flag=True 20 | elif password[i] in num: 21 | n_flag=True 22 | if n_flag: 23 | if i!=(len(password)-1): 24 | if num[((num.index(password[i]))+1)]==password[i+1]: 25 | nc_flag=False 26 | if c_flag and s_flag : 27 | c+=1 28 | if n_flag and nc_flag : 29 | c+=1 30 | if not password.isalnum(): 31 | c+=1 32 | if c==4: 33 | print('very strong') 34 | return 35 | if c==3: 36 | print('strong') 37 | return 38 | if c==2: 39 | print('moderate') 40 | return 41 | if c==1: 42 | print('week') 43 | return 44 | if c==0: 45 | print('use a different password') 46 | return 47 | -------------------------------------------------------------------------------- /task questions part 2.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "raw", 5 | "id": "3c0619f5-1793-4874-829a-625b6e12f3fc", 6 | "metadata": {}, 7 | "source": [ 8 | "Task 1" 9 | ] 10 | }, 11 | { 12 | "cell_type": "raw", 13 | "id": "d048c7da-1b25-4d94-943f-e1ea1da061fd", 14 | "metadata": {}, 15 | "source": [ 16 | "s = \"this is My First Python programming class and i am learNING python string and its function\"\n", 17 | "1 . Try to extract data from index one to index 300 with a jump of 3 \n", 18 | "2. Try to reverse a string without using reverse function \n", 19 | "3. Try to split a string after conversion of entire string in uppercase \n", 20 | "4. try to convert the whole string into lower case \n", 21 | "5 . Try to capitalize the whole string \n", 22 | "6 . Write a diference between isalnum() and isalpha()\n", 23 | "7. Try to give an example of expand tab\n", 24 | "8 . Give an example of strip , lstrip and rstrip \n", 25 | "9. Replace a string charecter by another charector by taking your own example \n", 26 | "\"sudhanshu\"\n", 27 | "10 . Try to give a defination of string center function with and exmple \n", 28 | "11 . Write your own definition of compiler and interpretor without copy paste form internet in your own language\n", 29 | "12 . Python is a interpreted of compiled language give a clear ans with your understanding \n", 30 | "13 . Try to write a usecase of python with your understanding ." 31 | ] 32 | }, 33 | { 34 | "cell_type": "raw", 35 | "id": "07c95b8f-af77-46de-8d54-008ff38fac12", 36 | "metadata": {}, 37 | "source": [ 38 | "Task 2" 39 | ] 40 | }, 41 | { 42 | "cell_type": "raw", 43 | "id": "0e251093-15b3-4cae-906b-e6cfcb8d2829", 44 | "metadata": {}, 45 | "source": [ 46 | "l = [3,4,5,6,7 , [23,456,67,8,78,78] , [345,56,87,8,98,9] , (234,6657,6) , {\"key1\" :\"sudh\" , 234:[23,45,656]}]\n", 47 | "1 . Try to reverse a list \n", 48 | "2. try to access 234 out of this list \n", 49 | "3 . try to access 456 \n", 50 | "4 . Try to extract only a list collection form list l \n", 51 | "5 . Try to extract \"sudh\"\n", 52 | "6 . Try to list all the key in dict element avaible in list \n", 53 | "7 . Try to extract all the value element form dict available in list" 54 | ] 55 | }, 56 | { 57 | "cell_type": "raw", 58 | "id": "c69012da-c17c-4d51-aa90-2821883fda73", 59 | "metadata": {}, 60 | "source": [ 61 | "Task 3" 62 | ] 63 | }, 64 | { 65 | "cell_type": "raw", 66 | "id": "df924ef0-ac76-4f10-8020-8fb81e338c0f", 67 | "metadata": {}, 68 | "source": [ 69 | "q1 :\n", 70 | "ineruon \n", 71 | "ineruon ineruon \n", 72 | "ineruon ineruon ineruon\n", 73 | "ineruon ineruon ineruon ineruon\n", 74 | "\n", 75 | "q2 - \n", 76 | "\n", 77 | " ineruon\n", 78 | " ineruon ineruon\n", 79 | "ineruon\t\tineruon \tineruon\n", 80 | "\tineruon\t\t ineruon\n", 81 | "\t\t ineruon\n", 82 | "\n", 83 | "l = [[1,2,3,4] , (2,3,4,5,6) , (3,4,5,6,7) , set([23,4,5,45,4,4,5,45,45,4,5]) , {'k1' :\"sudh\" , \"k2\" : \"ineuron\",\"k3\":\n", 84 | " \"kumar\" , 3:6 , 7:8} , [\"ineuron\" , \"data science \"]]\n", 85 | "\n", 86 | "q3 : Try to extract all the list entity \n", 87 | "q4 : Try to extract all the dict enteties\n", 88 | "q5 : Try to extract all the tuples entities\n", 89 | "q6 : Try to extract all the numerical data it may b a part of dict key and values \n", 90 | "q7 : Try to give summation of all the numeric data \n", 91 | "q8 : Try to filter out all the odd values out all numeric data which is a part of a list \n", 92 | "q9 : Try to extract \"ineruon\" out of this data\n", 93 | "q10 : Try to find out a number of occurances of all the data \n", 94 | "q11 : Try to find out number of keys in dict element\n", 95 | "q12 : Try to filter out all the string data \n", 96 | "q13 : Try to Find out alphanum in data\n", 97 | "q14 : Try to find out multiplication of all numeric value in the individual collection inside dataset" 98 | ] 99 | }, 100 | { 101 | "cell_type": "raw", 102 | "id": "9f511c8f-c8d3-4f88-8112-1e92c8aa1105", 103 | "metadata": {}, 104 | "source": [ 105 | "Task 4" 106 | ] 107 | }, 108 | { 109 | "cell_type": "raw", 110 | "id": "19a98172-eac2-49d6-9584-4dd6f8090d95", 111 | "metadata": {}, 112 | "source": [ 113 | "q1 : Try to print this by using while loop \n", 114 | "* \n", 115 | "* * \n", 116 | "* * * \n", 117 | "* * * * \n", 118 | "* * * * * \n", 119 | "* * * * * * \n", 120 | "* * * * * * * \n", 121 | "* * * * * * * * \n", 122 | "* * * * * * * * * \n", 123 | "\n", 124 | "q2 : try to print below by using while loop : \n", 125 | " \n", 126 | "A\n", 127 | "B H \n", 128 | "C I N\n", 129 | "D J o S\n", 130 | "E K p T W\n", 131 | "F L Q U X z\n", 132 | "G M R V Y \n", 133 | "\n", 134 | "q3 : Try to print all the number divisible by 3 in between a range of 40 - 400\n", 135 | " \n", 136 | "q4 : Try to filter out all the vowels form below text by using while loop : \n", 137 | " \"\"\"Python is a high-level, interpreted, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.[32]\n", 138 | "\n", 139 | "Python is dynamically-typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming. It is often described as a \"batteries included\" language due to its comprehensive standard library.[33][34]\n", 140 | "\n", 141 | "Guido van Rossum began working on Python in the late 1980s as a successor to the ABC programming language and first released it in 1991 as Python 0.9.0.[35] Python 2.0 was released in 2000 and introduced new features such as list comprehensions, cycle-detecting garbage collection, reference counting, and Unicode support. Python 3.0, released in 2008, was a major revision that is not completely backward-compatible with earlier versions. Python 2 was discontinued with version 2.7.18 in 2020.[36]\n", 142 | "\n", 143 | "Python consistently ranks as one of the most popular programming languagesc\"\"\" \n", 144 | "\n", 145 | "\n", 146 | "q5 : Try to generate all the even number between 1- 1000\n", 147 | "\n", 148 | "q6 : Define a function for all the above problem statememnt . \n", 149 | " \n", 150 | "q7 : write a code to get a time of your system \n", 151 | "\n", 152 | "q8 : Write a code to fetch date form your system \n", 153 | "\n", 154 | "q9 : Write a code to send a mail to your friend \n", 155 | "\n", 156 | "q10 : write a code to trigger alarm for you at scheduled time \n", 157 | "\n", 158 | "q11 : write a code to check ip address of your system \n", 159 | "\n", 160 | "q12 : Write a code to check a perticular installation in your system\n", 161 | "\n", 162 | "q13 : Write a code to convert any text in to voice \n", 163 | "\n", 164 | "q14 : you have to write a fun which will take string and return a len of \n", 165 | "it without using a inbuilt fun len\n", 166 | "\n", 167 | "q15 :write a fun which will be able to print an index of all premitive element which you will pass \n", 168 | "\n", 169 | "q16 : Write a fun which will take input as a dict and give me out as a list of all the values \n", 170 | "even in case of 2 level nesting it should work . \n", 171 | "\n", 172 | "q17 : write a function whihc will take multiple list as a input and give me concatnation of all the element as \n", 173 | "and output\n", 174 | "\n", 175 | "q18 : Write a function which will whould return list of all the file name from a directory . \n", 176 | "\n", 177 | "q19 : write a function whihc will be able to read a image file and show it to you .\n", 178 | " \n", 179 | "q20 : write a function by which you will be able to append two PDF files . \n", 180 | " \n", 181 | "q21 : write a function which can help you to filter only word file from a directory . \n", 182 | " \n", 183 | "q22 : write a function which can read video file and play for you . \n", 184 | " \n", 185 | "q23 : write a function which will be able to shutdonw your system . \n", 186 | "\n", 187 | "q24 : Write a function which will whould return list of all the file name from a directory . \n", 188 | "\n", 189 | "q25 : write a function whihc will be able to access your mail . " 190 | ] 191 | } 192 | ], 193 | "metadata": { 194 | "kernelspec": { 195 | "display_name": "Python 3 (ipykernel)", 196 | "language": "python", 197 | "name": "python3" 198 | }, 199 | "language_info": { 200 | "codemirror_mode": { 201 | "name": "ipython", 202 | "version": 3 203 | }, 204 | "file_extension": ".py", 205 | "mimetype": "text/x-python", 206 | "name": "python", 207 | "nbconvert_exporter": "python", 208 | "pygments_lexer": "ipython3", 209 | "version": "3.10.6" 210 | } 211 | }, 212 | "nbformat": 4, 213 | "nbformat_minor": 5 214 | } 215 | -------------------------------------------------------------------------------- /questions.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "raw", 5 | "id": "60b6f0c4-87d7-464a-a919-fafe79fbb6eb", 6 | "metadata": {}, 7 | "source": [ 8 | "1. Print the first 5 positive integers in ascending order with one number \n", 9 | "in each line" 10 | ] 11 | }, 12 | { 13 | "cell_type": "raw", 14 | "id": "a723c70f-2393-4dcc-b34c-2e045588207b", 15 | "metadata": {}, 16 | "source": [ 17 | "2. Print the following pattern\n", 18 | "*\n", 19 | "**\n", 20 | "***\n", 21 | "****\n", 22 | "*****\n", 23 | "There are no spaces between consecutive stars. There are no spaces \n", 24 | "at the end of each line." 25 | ] 26 | }, 27 | { 28 | "cell_type": "raw", 29 | "id": "d9263791-a394-44ee-8ba9-4fb01759b6ac", 30 | "metadata": {}, 31 | "source": [ 32 | "3. Accept an integer as input and print its square as output." 33 | ] 34 | }, 35 | { 36 | "cell_type": "raw", 37 | "id": "49ca4411-ab36-4e57-8d62-3628156bc49b", 38 | "metadata": {}, 39 | "source": [ 40 | "4.Accept two integers as input and print their sum as output." 41 | ] 42 | }, 43 | { 44 | "cell_type": "raw", 45 | "id": "f303afc2-f3af-4d9d-a4d8-7c2da8f24e3c", 46 | "metadata": {}, 47 | "source": [ 48 | "5. Accept two words as input and print the two words after adding a \n", 49 | "space between them" 50 | ] 51 | }, 52 | { 53 | "cell_type": "raw", 54 | "id": "1fdd53ab-a380-4caa-bdec-2876024a044d", 55 | "metadata": {}, 56 | "source": [ 57 | "6. Accept the registration number of a vehicle as input and print its \n", 58 | "state-code as output." 59 | ] 60 | }, 61 | { 62 | "cell_type": "raw", 63 | "id": "e476d0d4-2d90-4764-b4ce-91d6d67729c2", 64 | "metadata": {}, 65 | "source": [ 66 | "7.Accept a five-digit number as input and print the sum of its digits as \n", 67 | "output." 68 | ] 69 | }, 70 | { 71 | "cell_type": "raw", 72 | "id": "47ef2a83-4d51-4340-8770-9490474f43a9", 73 | "metadata": {}, 74 | "source": [ 75 | "8.Accept five words as input and print the sentence formed by these \n", 76 | "words after adding a space between consecutive words and a full stop \n", 77 | "at the end." 78 | ] 79 | }, 80 | { 81 | "cell_type": "raw", 82 | "id": "7b0fb9d7-98dc-4ab9-9548-c12f49f787a0", 83 | "metadata": {}, 84 | "source": [ 85 | "9.Accept the date in DD-MM-YYYY format as input and print the \n", 86 | "year as output." 87 | ] 88 | }, 89 | { 90 | "cell_type": "raw", 91 | "id": "521abc20-5c4a-4fda-a3d7-45c626ad4d1c", 92 | "metadata": {}, 93 | "source": [ 94 | "10.Accept a sequence of five single digit numbers separated by commas \n", 95 | "as input. Print the product of all five numbers." 96 | ] 97 | }, 98 | { 99 | "cell_type": "raw", 100 | "id": "482e853e-2564-4eaf-a46b-0f31d3369f58", 101 | "metadata": {}, 102 | "source": [ 103 | "11. Accept two positive integers x and y as input. Print the number of \n", 104 | "digits in xy" 105 | ] 106 | }, 107 | { 108 | "cell_type": "raw", 109 | "id": "af890b67-6c1f-412c-bbbe-8fc1358e0a91", 110 | "metadata": {}, 111 | "source": [ 112 | "12. Accept a string as input. If the input string is of odd length, then \n", 113 | "continue with it. If the input string is of even length, make the \n", 114 | "string of odd length as below:\n", 115 | "• If the last character is a period (.), then remove it \n", 116 | "• If the last character is not a period, then add a period (.) to the \n", 117 | "end of the string\n", 118 | "Call this string of odd length word. Select a substring made up of \n", 119 | "three consecutive characters from word such that there are an \n", 120 | "equal number of characters to the left and right of this substring. \n", 121 | "Print this substring as output. You can assume that all input \n", 122 | "strings will be in lower case and will have a length of at least four" 123 | ] 124 | }, 125 | { 126 | "cell_type": "raw", 127 | "id": "7188ddf7-aeae-43c7-add9-8a31e08a2bc9", 128 | "metadata": {}, 129 | "source": [ 130 | "13. Accept three positive integers as input and check if they form the \n", 131 | "sides of a right triangle. Print YES if they form one, and NO is they do \n", 132 | "not. The input will have three lines, with one integer on each line. \n", 133 | "The output should be a single line containing one of these two \n", 134 | "strings: YES or NO." 135 | ] 136 | }, 137 | { 138 | "cell_type": "raw", 139 | "id": "5e16b40c-a122-4dbc-a681-bca1fe32a1dc", 140 | "metadata": {}, 141 | "source": [ 142 | "14. EvenOdd is a tech startup. Each employee at the startup is given an employee id which is a unique \n", 143 | "positive integer. On one warm Sunday evening, five employees of the company come together for a \n", 144 | "meeting and sit at a circular table:\n", 145 | "The employees follow a strange convention. They will continue the meeting only if the following \n", 146 | "condition is satisfied.\n", 147 | "The sum of the employee-ids of every pair of adjacent employees at the table must be an even \n", 148 | "number.\n", 149 | "They are so lazy that they won’t move around to satisfy the above condition, If the current seating \n", 150 | "plan doesn’t satisfy the condition, the meeting will be cancelled. You are given the employee-id of all \n", 151 | "five employees. Your task is to decide if the meeting happened or not.\n", 152 | "The input will be five lined, each containing an integer. The ith line will have the employee-id of Ei. \n", 153 | "The output will be a single line containing one of these two strings: YES or NO" 154 | ] 155 | }, 156 | { 157 | "cell_type": "raw", 158 | "id": "1d651eb9-add5-4f2b-9a92-57303f327be3", 159 | "metadata": {}, 160 | "source": [ 161 | "15. Accept a string as input and print the vowels present in the string in \n", 162 | "alphabetical order. If the string doesn’t contain any vowels, then \n", 163 | "print the string none as output. Each vowel that appears in the input \n", 164 | "string – irrespective of its case should appear just once in lower case \n", 165 | "in the output" 166 | ] 167 | }, 168 | { 169 | "cell_type": "raw", 170 | "id": "f7e76b4b-b3f7-4766-a82b-5e63a879b380", 171 | "metadata": {}, 172 | "source": [ 173 | "16.You are given the date of birth of two persons, not necessarily from \n", 174 | "the same family. Your task is to find the younger of the two. If both \n", 175 | "of them share the same date of birth, then the younger of the two is \n", 176 | "assumed to be that person whose name comes first in alphabetical \n", 177 | "order.\n", 178 | "The input will have four lines. The first two lines correspond to the \n", 179 | "first person, while the last two lines correspond to the second \n", 180 | "person. For each person, the first line corresponds to the name and \n", 181 | "the second line corresponds to the date of birth in “DD-MM-YYYY” \n", 182 | "format. Your output should be the name of the younger of the two." 183 | ] 184 | }, 185 | { 186 | "cell_type": "raw", 187 | "id": "6ee8f8bd-15aa-40d8-9cef-2f7e22f6cf5d", 188 | "metadata": {}, 189 | "source": [ 190 | "17.Accept a string as input. Your task is to determine if the input string is a valid password or not. For a \n", 191 | "string to be a valid password, it must satisfy all the conditions given below:\n", 192 | "(1) It should have at least 8 and at most 32 characters\n", 193 | "(2) It should start with an uppercase or lowercase letter\n", 194 | "(3) It should not have any of these characters: / \\ = ' \"\n", 195 | "(4) It should not have spaces\n", 196 | "It could have any character that is not mentioned in the list of characters to be avoided (points 3 and \n", 197 | "4). Output True if the string forms a valid password and False otherwise" 198 | ] 199 | }, 200 | { 201 | "cell_type": "raw", 202 | "id": "a4d2f09c-6787-477e-8ed5-4ed4257469cb", 203 | "metadata": {}, 204 | "source": [ 205 | "18. Accept a positive integer n as input and print the first n positive \n", 206 | "integers, one number on each line." 207 | ] 208 | }, 209 | { 210 | "cell_type": "raw", 211 | "id": "0527265b-0110-476d-8bf6-6a724749197e", 212 | "metadata": {}, 213 | "source": [ 214 | "19.Accept a positive integer n as input, where n is greater than 1. \n", 215 | "Print PRIME ifnis a prime number and NOTPRIME otherwise." 216 | ] 217 | }, 218 | { 219 | "cell_type": "raw", 220 | "id": "8d8297d3-a658-4afd-9b7f-b2ee198faa52", 221 | "metadata": {}, 222 | "source": [ 223 | "20. Accept two strings as input and form a new string by removing all \n", 224 | "characters from the second string which are present in the first string. \n", 225 | "Print this new string as output. You can assume that all input strings \n", 226 | "will be in lower case." 227 | ] 228 | }, 229 | { 230 | "cell_type": "raw", 231 | "id": "9d4ca698-02c3-415a-8b99-7b59c5702d8d", 232 | "metadata": {}, 233 | "source": [ 234 | "21.Accept a phone number as input. A valid phone number should satisfy \n", 235 | "the following constraints.\n", 236 | "(1) The number should start with one of these digits: 6, 7, 8, 9\n", 237 | "(2) The number should be exactly 10 digits long.\n", 238 | "(3) No digit should appear more than 7 times in the number.\n", 239 | "(4) No digit should appear more than 5 times in a row in the \n", 240 | "number.\n", 241 | "If the fourth condition is not very clear, then consider this example: \n", 242 | "the number 9888888765 is invalid because the digit 8 appears more \n", 243 | "than 5 times in a row. Print the string valid if the phone number is \n", 244 | "valid. If not, print the string invalid." 245 | ] 246 | }, 247 | { 248 | "cell_type": "raw", 249 | "id": "781b0869-d8b7-4f2f-b4cd-16d0e128fd0f", 250 | "metadata": {}, 251 | "source": [ 252 | "22. In the first line of input, accept a sequence of space-separated words. In the second line of \n", 253 | "input, accept a single word. If this word is not present in the sequence, print NO. If this word \n", 254 | "is present in the sequence, then print YES and in the next line of the output, print the number \n", 255 | "of times the word appears in the sequence." 256 | ] 257 | }, 258 | { 259 | "cell_type": "raw", 260 | "id": "ea752210-2e2a-428b-937c-31251daf7ba8", 261 | "metadata": {}, 262 | "source": [ 263 | "23. Write a function named factorial that accepts an integer n as argument. It should return \n", 264 | "the factorial of n if n is a positive integer. It should return -1 if n is a negative integer, and it \n", 265 | "should return 1 if n is zero." 266 | ] 267 | }, 268 | { 269 | "cell_type": "raw", 270 | "id": "c757a0b6-8450-47af-9b1f-f6ce69ebc775", 271 | "metadata": {}, 272 | "source": [ 273 | "24. \n", 274 | "The range of a list of numbers is the difference between the maximum and minimum values in the list\n", 275 | "Write a function named get_range that accepts a non-empty list of real numbers as argument. It \n", 276 | "should return the range of the list.\n", 277 | "(1) Avoid using built-in function such as max and min.\n", 278 | "(2) You do not have to accept input from the user or print output to the console. You just have to write \n", 279 | "the function definition." 280 | ] 281 | }, 282 | { 283 | "cell_type": "raw", 284 | "id": "8f3ba3db-9ed9-4c14-ac23-41f3225ad874", 285 | "metadata": {}, 286 | "source": [ 287 | "25. Write a function named read_file that accepts a text file named filename as argument. Within \n", 288 | "the function, read the file and print each line of the file on a separate line in the console. You shouldn't \n", 289 | "print any extra characters at the end of a line. There shouldn't be an empty line between any two \n", 290 | "consecutive lines.\n", 291 | "(1) filename is a string variable that holds the name of the file. For example, in the first test case, it \n", 292 | "is filename = 'public_1.txt'.\n", 293 | "(2) You do not have to accept input from the console. You have to write the function definition and \n", 294 | "print the contents of the file within the function" 295 | ] 296 | }, 297 | { 298 | "cell_type": "raw", 299 | "id": "b2d94805-f65b-47c2-9d18-2a8bdbe5c2dc", 300 | "metadata": {}, 301 | "source": [ 302 | "26. A simple algorithm has to be designed to find out whether a student \n", 303 | "belongs to the Data Science branch or not. The input will be a \n", 304 | "student's roll number, which is of the form BR18B0000. \n", 305 | "Here, BR represents the branch code, 18 represents the year of \n", 306 | "joining, B represents the education level and 0000 represents the \n", 307 | "specific identification given to the student of that batch. The branch \n", 308 | "code for Data Science is DS. Print True if the student belongs to \n", 309 | "Data Science branch and False otherwise." 310 | ] 311 | }, 312 | { 313 | "cell_type": "raw", 314 | "id": "52e69e6b-ab1d-411c-8750-7a2de08bc8dd", 315 | "metadata": {}, 316 | "source": [ 317 | "27.The police are trying to track a criminal based on the evidence \n", 318 | "available at a crime site. Their main clue is a vehicle's damaged \n", 319 | "number plate. Only the string TN07 is visible. The format of the \n", 320 | "registration number is AA00AA00, where the first two letters are \n", 321 | "alphabets, next two are numbers, next two are again alphabets \n", 322 | "followed by two numbers at the end. A number plate is picked from a \n", 323 | "database of registration numbers and is given to you as input. Your \n", 324 | "task is to determine if this could belong to the criminal or not. \n", 325 | "Print True if the number plate \n", 326 | "contains TN07 and False otherwise." 327 | ] 328 | }, 329 | { 330 | "cell_type": "raw", 331 | "id": "11b4a079-30a1-480d-a759-2b54ab29f90f", 332 | "metadata": {}, 333 | "source": [ 334 | "28. You are given a string and two non-negative integers as input. The \n", 335 | "two integers specify the start and end indices of a substring in the \n", 336 | "given string. Create a new string by replicating the substring a \n", 337 | "minimum number of times so that the resulting string is longer than \n", 338 | "the input string. The input parameters are the string, start index of \n", 339 | "the substring and the end index of substring (endpoints inclusive) \n", 340 | "each on a different line." 341 | ] 342 | }, 343 | { 344 | "cell_type": "raw", 345 | "id": "2c2d9d8e-e84a-4ca1-8791-8033b8e650a0", 346 | "metadata": {}, 347 | "source": [ 348 | "29. A class teacher has decided to split her entire class into four groups, namely Sapphire, Peridot, Ruby, \n", 349 | "and Emerald for sports competitions. For dividing the students into these four groups, she has \n", 350 | "followed the pattern given below:\n", 351 | "Sapphire - 1, 5, 9, 13, 17, 21, ...\n", 352 | "Peridot - 2, 6, 10, 14, 18, 22, ...\n", 353 | "Ruby - 3, 7, 11, 15, 19, 23, ...\n", 354 | "Emerald - 4, 8, 12, 16, 20, 24, ...\n", 355 | "All the students are represented by their roll numbers. Based on the above pattern, given the roll \n", 356 | "number as input, print the group the student belongs to. Note that the roll number can be any \n", 357 | "positive integer and not necessarily less than 25." 358 | ] 359 | }, 360 | { 361 | "cell_type": "raw", 362 | "id": "7e18467c-5ccb-4820-bc5f-c4adc9babe2c", 363 | "metadata": {}, 364 | "source": [ 365 | "30. A data science company wants to hire data scientists from abc college. \n", 366 | "The company follows a certain criteria for selection: for a student to \n", 367 | "be selected, the number of backlogs should be at most 5 and the \n", 368 | "CGPA (Cumulative Grade Point Average) should be greater than 6. If \n", 369 | "the student does not fit the above criteria, then the student is not \n", 370 | "offered the job. If the student is selected, then the salary offered is \n", 371 | "equal to 5 times his/her CGPA (in lakhs).\n", 372 | "Accept the number of backlogs (integer) and the CGPA (float) of the \n", 373 | "student as input. Your task is to determine if the student is selected or \n", 374 | "not. If the student is selected, then print the package. If not, then \n", 375 | "print the string Not Selected." 376 | ] 377 | }, 378 | { 379 | "cell_type": "raw", 380 | "id": "15b2b2b3-e511-4184-af23-c42d9ee021b8", 381 | "metadata": {}, 382 | "source": [ 383 | "31. Accept a string as input and print PALINDROME if it is a \n", 384 | "palindrome, and NOT PALINDROME otherwise" 385 | ] 386 | }, 387 | { 388 | "cell_type": "raw", 389 | "id": "92cfcd2b-ae26-4009-85b4-15e7996421ac", 390 | "metadata": {}, 391 | "source": [ 392 | "32. In a portal login website, you are asked to write a function get_password_strength to decide \n", 393 | "the strength of a password. The strength is decided based on the total score of the password, Use \n", 394 | "following conditions:\n", 395 | "1) If password has length greater than 7 then score increases by one point.\n", 396 | "2) If password has at least one upper case and one lower case alphabets score increases by one point.\n", 397 | "3) If password has at least one number and no consecutive numbers like 12 or 234 then score \n", 398 | "increases by one point.\n", 399 | "4) If password has at least one special character (any character other than numbers and alphabets) then \n", 400 | "score increases by one point.\n", 401 | "5) If password contains username, then it is invalid password.\n", 402 | "If the password has score of four points, three points, two points, or one point then print Very \n", 403 | "Strong, Strong, Moderate, or Weak respectively. If the password is invalid, then \n", 404 | "print PASSWORD SHOULD NOT CONTAIN USERNAME and If the score is zero, then print Use a \n", 405 | "different password.The arguments to the function are username and password which are \n", 406 | "already defined" 407 | ] 408 | }, 409 | { 410 | "cell_type": "raw", 411 | "id": "67644faf-c8dc-439d-9c26-54b16751b2e0", 412 | "metadata": {}, 413 | "source": [ 414 | "33.decorator that logs the date and time" 415 | ] 416 | }, 417 | { 418 | "cell_type": "raw", 419 | "id": "93474414-e8ba-439d-9f7d-0f3f4eb648b9", 420 | "metadata": {}, 421 | "source": [ 422 | "34.Program to Get Data Items From a List Appearing Odd Number of Times" 423 | ] 424 | }, 425 | { 426 | "cell_type": "raw", 427 | "id": "70caf71f-6a2d-42a5-bb41-a83e99f3b0cb", 428 | "metadata": {}, 429 | "source": [ 430 | "35.What are decorators in Python?" 431 | ] 432 | }, 433 | { 434 | "cell_type": "raw", 435 | "id": "00d3f3e6-8d1a-459c-8f05-fec2d7a72f0b", 436 | "metadata": {}, 437 | "source": [ 438 | "36. remove items from a list while iterating but without creating a different copy of a list.\n", 439 | "Remove numbers greater than 50\n", 440 | "number_list = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]\n", 441 | "Expected Output: [10, 20, 30, 40, 50]" 442 | ] 443 | }, 444 | { 445 | "cell_type": "raw", 446 | "id": "6a034cd6-9a75-4912-8286-2396360ffa28", 447 | "metadata": {}, 448 | "source": [ 449 | "37. Display all duplicate items from a list\n", 450 | "sample_list = [10, 20, 60, 30, 20, 40, 30, 60, 70, 80]\n", 451 | "Expected Output: [20, 60, 30]" 452 | ] 453 | }, 454 | { 455 | "cell_type": "raw", 456 | "id": "03607aeb-291c-41e0-bb35-101d53d1f25f", 457 | "metadata": {}, 458 | "source": [ 459 | "38. Create an outer function that will accept two strings, x and y. (x= 'Emma' and y = 'Kelly'.\n", 460 | "Create an inner function inside an outer function that will concatenate x and y.\n", 461 | "At last, an outer function will join the word 'developer' to it." 462 | ] 463 | }, 464 | { 465 | "cell_type": "raw", 466 | "id": "c3238d35-61fa-4d2a-8e92-c393399b1b5b", 467 | "metadata": {}, 468 | "source": [ 469 | "39. Modify the element of a nested list inside the following list\n", 470 | "Change the element 35 to 3500\n", 471 | "list1 = [5, [10, 15, [20, 25, [30, 35], 40], 45], 50]" 472 | ] 473 | }, 474 | { 475 | "cell_type": "raw", 476 | "id": "0106b7da-e95f-46ba-873a-e641d7199be7", 477 | "metadata": {}, 478 | "source": [ 479 | "40. Access the nested key increment from the following dictionary\n", 480 | "Access 12\n", 481 | "emp_dict = {\n", 482 | " \"company\": {\n", 483 | " \"employee\": {\n", 484 | " \"name\": \"Jess\",\n", 485 | " \"payable\": {\n", 486 | " \"salary\": 9000,\n", 487 | " \"increment\": 12\n", 488 | " }\n", 489 | " }\n", 490 | " }\n", 491 | "}" 492 | ] 493 | }, 494 | { 495 | "cell_type": "raw", 496 | "id": "a36e12a4-baf9-4c0b-90e6-c16fd60b02ba", 497 | "metadata": {}, 498 | "source": [ 499 | "41. Print the sum of the current number and the previous number\n", 500 | "Write a program to iterate the first 10 numbers and in each iteration, print the sum of the current and previous number.\n", 501 | "Printing current and previous number sum in a range(10)\n", 502 | "Current Number 0 Previous Number 0 Sum: 0\n", 503 | "Current Number 1 Previous Number 0 Sum: 1\n", 504 | "Current Number 2 Previous Number 1 Sum: 3\n", 505 | "Current Number 3 Previous Number 2 Sum: 5\n", 506 | "Current Number 4 Previous Number 3 Sum: 7\n", 507 | "Current Number 5 Previous Number 4 Sum: 9\n", 508 | "Current Number 6 Previous Number 5 Sum: 11\n", 509 | "Current Number 7 Previous Number 6 Sum: 13\n", 510 | "Current Number 8 Previous Number 7 Sum: 15\n", 511 | "Current Number 9 Previous Number 8 Sum: 17" 512 | ] 513 | }, 514 | { 515 | "cell_type": "raw", 516 | "id": "04f5ef21-9056-4a31-bc4d-b5641a6bc80d", 517 | "metadata": {}, 518 | "source": [ 519 | "42. Print characters from a string that are present at an even index number\n", 520 | "Write a program to accept a string from the user and display characters that are present at an even index number.\n", 521 | "\n", 522 | "For example, str = \"ineuron\" so you should display ‘i’, ‘e’, ‘r’, ‘n’." 523 | ] 524 | }, 525 | { 526 | "cell_type": "raw", 527 | "id": "19f5f95f-8e4e-48c8-8639-247f8f058efa", 528 | "metadata": {}, 529 | "source": [ 530 | "43. Print multiplication table form 1 to 10\n", 531 | "1 2 3 4 5 6 7 8 9 10 \t\t\n", 532 | "2 4 6 8 10 12 14 16 18 20 \t\t\n", 533 | "3 6 9 12 15 18 21 24 27 30 \t\t\n", 534 | "4 8 12 16 20 24 28 32 36 40 \t\t\n", 535 | "5 10 15 20 25 30 35 40 45 50 \t\t\n", 536 | "6 12 18 24 30 36 42 48 54 60 \t\t\n", 537 | "7 14 21 28 35 42 49 56 63 70 \t\t\n", 538 | "8 16 24 32 40 48 56 64 72 80 \t\t\n", 539 | "9 18 27 36 45 54 63 72 81 90 \t\t\n", 540 | "10 20 30 40 50 60 70 80 90 100 " 541 | ] 542 | }, 543 | { 544 | "cell_type": "raw", 545 | "id": "07f9b814-fc05-4a97-8a50-b762ab2522e6", 546 | "metadata": {}, 547 | "source": [ 548 | "44. Remove duplicates from a list and create a tuple and find the minimum and maximum number\n", 549 | "sample_list = [87, 45, 41, 65, 94, 41, 99, 94]\n", 550 | "Expected Outcome:\n", 551 | "unique items [87, 45, 41, 65, 99]\n", 552 | "tuple (87, 45, 41, 65, 99)\n", 553 | "min: 41\n", 554 | "max: 99" 555 | ] 556 | }, 557 | { 558 | "cell_type": "raw", 559 | "id": "f4d4b1a2-7c19-43c4-922c-837b6c40f5fb", 560 | "metadata": {}, 561 | "source": [ 562 | "45. Write a Python program to create a lambda function that adds 15 to a given number passed in as an argument,\n", 563 | "also create a lambda function\n", 564 | "that multiplies argument x with argument y and print the result." 565 | ] 566 | }, 567 | { 568 | "cell_type": "raw", 569 | "id": "58df2f9a-6310-4e59-a5fe-6658ff7898e1", 570 | "metadata": {}, 571 | "source": [ 572 | "46. Write a Python program to sort a list of tuples using Lambda." 573 | ] 574 | }, 575 | { 576 | "cell_type": "raw", 577 | "id": "745bbb70-f71c-4042-a99a-f42bccef267e", 578 | "metadata": {}, 579 | "source": [ 580 | "47. Write a Python program to extract year, month, date and time using Lambda." 581 | ] 582 | }, 583 | { 584 | "cell_type": "raw", 585 | "id": "afcf0f97-d39b-4554-a14f-411096bd515e", 586 | "metadata": {}, 587 | "source": [ 588 | "48. Write a Python program to count the even, odd numbers in a given array of integers using Lambda." 589 | ] 590 | }, 591 | { 592 | "cell_type": "raw", 593 | "id": "dbd65ee9-2f83-4286-a7b3-52f398ab8527", 594 | "metadata": {}, 595 | "source": [ 596 | "49. Write a Python program to convert all the characters in uppercase and lowercase and eliminate duplicate letters from a given sequence.\n", 597 | "Use map() function." 598 | ] 599 | }, 600 | { 601 | "cell_type": "raw", 602 | "id": "78c63beb-b43b-48ad-bb20-31f403af2f10", 603 | "metadata": {}, 604 | "source": [ 605 | "50. Write a Python program to square the elements of a list using map() function." 606 | ] 607 | } 608 | ], 609 | "metadata": { 610 | "kernelspec": { 611 | "display_name": "Python 3 (ipykernel)", 612 | "language": "python", 613 | "name": "python3" 614 | }, 615 | "language_info": { 616 | "codemirror_mode": { 617 | "name": "ipython", 618 | "version": 3 619 | }, 620 | "file_extension": ".py", 621 | "mimetype": "text/x-python", 622 | "name": "python", 623 | "nbconvert_exporter": "python", 624 | "pygments_lexer": "ipython3", 625 | "version": "3.10.6" 626 | } 627 | }, 628 | "nbformat": 4, 629 | "nbformat_minor": 5 630 | } 631 | -------------------------------------------------------------------------------- /26th class solutions.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "raw", 5 | "id": "da66b7c9-325d-4a97-9951-51145ffb0b82", 6 | "metadata": {}, 7 | "source": [ 8 | "35. What are decorators in Python?" 9 | ] 10 | }, 11 | { 12 | "cell_type": "raw", 13 | "id": "44a888db-fca0-43dd-9d9d-9f32cf8f6f98", 14 | "metadata": {}, 15 | "source": [ 16 | "Decorators\n", 17 | " in Python are essentially functions that add functionality to an existing function in Python\n", 18 | " without changing the structure of the function itself. They are represented by the\n", 19 | "@decorator_name\n", 20 | " inPython and are called in bottom-up fashion. For example:\n", 21 | " \n", 22 | " \n" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": 2, 28 | "id": "d1f73797-7be0-4ad0-bb31-3068c33817f0", 29 | "metadata": {}, 30 | "outputs": [], 31 | "source": [ 32 | "# decorator function to convert to lowercase\n", 33 | "def lowercase_decorator(function):\n", 34 | " def wrapper():\n", 35 | " func = function()\n", 36 | " string_lowercase = func.lower()\n", 37 | " return string_lowercase\n", 38 | " return wrapper\n", 39 | "\n", 40 | "# decorator function to split words\n", 41 | "\n", 42 | "def splitter_decorator(function):\n", 43 | " def wrapper():\n", 44 | " func = function()\n", 45 | " string_split = func.split()\n", 46 | " return string_split\n", 47 | " return wrapper\n", 48 | "\n" 49 | ] 50 | }, 51 | { 52 | "cell_type": "code", 53 | "execution_count": 3, 54 | "id": "d48e31ed-21e5-44ac-9cc6-19e9a43916f3", 55 | "metadata": {}, 56 | "outputs": [], 57 | "source": [ 58 | "@splitter_decorator #will execute next\n", 59 | "@lowercase_decorator #will execute first\n", 60 | "def hello():\n", 61 | " return 'hello world'" 62 | ] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": 4, 67 | "id": "40d642c3-ed58-480a-9914-9fcd83c8ac27", 68 | "metadata": {}, 69 | "outputs": [ 70 | { 71 | "data": { 72 | "text/plain": [ 73 | "['hello', 'world']" 74 | ] 75 | }, 76 | "execution_count": 4, 77 | "metadata": {}, 78 | "output_type": "execute_result" 79 | } 80 | ], 81 | "source": [ 82 | "hello()" 83 | ] 84 | }, 85 | { 86 | "cell_type": "raw", 87 | "id": "36945abf-5be6-4881-9650-018247f6405b", 88 | "metadata": {}, 89 | "source": [ 90 | "36. remove items from a list while iterating but without creating a different copy of a list.\n", 91 | "Remove numbers greater than 50\n", 92 | "number_list = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]\n", 93 | "Expected Output: [10, 20, 30, 40, 50]" 94 | ] 95 | }, 96 | { 97 | "cell_type": "code", 98 | "execution_count": 1, 99 | "id": "0310e40a-20dd-4b2e-80c1-22be50fd08aa", 100 | "metadata": {}, 101 | "outputs": [ 102 | { 103 | "name": "stdout", 104 | "output_type": "stream", 105 | "text": [ 106 | "[10, 20, 30, 40, 50]\n" 107 | ] 108 | } 109 | ], 110 | "source": [ 111 | "number_list = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]\n", 112 | "i = 0\n", 113 | "# get list's size\n", 114 | "n = len(number_list)\n", 115 | "# iterate list till i is smaller than n\n", 116 | "while i < n:\n", 117 | " # check if number is greater than 50\n", 118 | " if number_list[i] > 50:\n", 119 | " # delete current index from list\n", 120 | " del number_list[i]\n", 121 | " # reduce the list size\n", 122 | " n = n - 1\n", 123 | " else:\n", 124 | " # move to next item\n", 125 | " i = i + 1\n", 126 | "print(number_list)" 127 | ] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": 3, 132 | "id": "09d31d76-b050-409c-adb1-fc226f93193f", 133 | "metadata": {}, 134 | "outputs": [ 135 | { 136 | "name": "stdout", 137 | "output_type": "stream", 138 | "text": [ 139 | "[10, 20, 30, 40, 50]\n" 140 | ] 141 | } 142 | ], 143 | "source": [ 144 | "#range(start, stop, step)\n", 145 | "number_list = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]\n", 146 | "for i in range(len(number_list) - 1, -1, -1):\n", 147 | " if number_list[i] > 50:\n", 148 | " del number_list[i]\n", 149 | "print(number_list)" 150 | ] 151 | }, 152 | { 153 | "cell_type": "code", 154 | "execution_count": 2, 155 | "id": "8e9fe023-7132-46a0-824c-aa08609a18b2", 156 | "metadata": {}, 157 | "outputs": [ 158 | { 159 | "name": "stdout", 160 | "output_type": "stream", 161 | "text": [ 162 | "10\n", 163 | "9\n", 164 | "8\n", 165 | "7\n", 166 | "6\n", 167 | "5\n", 168 | "4\n", 169 | "3\n", 170 | "2\n", 171 | "1\n", 172 | "0\n" 173 | ] 174 | } 175 | ], 176 | "source": [ 177 | "for i in range(10,-1,-1):\n", 178 | " print (i)" 179 | ] 180 | }, 181 | { 182 | "cell_type": "raw", 183 | "id": "b9899cff-026e-48c4-91e4-6504f6cbb335", 184 | "metadata": {}, 185 | "source": [ 186 | "37. Display all duplicate items from a list\n", 187 | "sample_list = [10, 20, 60, 30, 20, 40, 30, 60, 70, 80]\n", 188 | "Expected Output: [20, 60, 30]\n", 189 | "\n", 190 | " \n" 191 | ] 192 | }, 193 | { 194 | "cell_type": "code", 195 | "execution_count": 4, 196 | "id": "51cdaf8f-d322-4018-85ea-3b8e14864a5c", 197 | "metadata": {}, 198 | "outputs": [ 199 | { 200 | "name": "stdout", 201 | "output_type": "stream", 202 | "text": [ 203 | "[20, 60, 30]\n" 204 | ] 205 | } 206 | ], 207 | "source": [ 208 | "import collections\n", 209 | "\n", 210 | "sample_list = [10, 20, 60, 30, 20, 40, 30, 60, 70, 80]\n", 211 | "\n", 212 | "duplicates = []\n", 213 | "for item, count in collections.Counter(sample_list).items():\n", 214 | " if count > 1:\n", 215 | " duplicates.append(item)\n", 216 | "print(duplicates)\n", 217 | "\n", 218 | "# class collections.Counter([iterable-or-mapping])\n", 219 | "#It is used to keep the count of the elements in an iterable in the form of an unordered dictionary\n", 220 | "#where the key represents the element in the iterable and value represents the count of that element in the iterable." 221 | ] 222 | }, 223 | { 224 | "cell_type": "code", 225 | "execution_count": 5, 226 | "id": "985c0327-3a9f-4d67-8663-a7788c2632b4", 227 | "metadata": {}, 228 | "outputs": [ 229 | { 230 | "name": "stdout", 231 | "output_type": "stream", 232 | "text": [ 233 | "[20, 30, 60]\n" 234 | ] 235 | } 236 | ], 237 | "source": [ 238 | "sample_list = [10, 20, 60, 30, 20, 40, 30, 60, 70, 80]\n", 239 | "exist = {}\n", 240 | "duplicates = []\n", 241 | "\n", 242 | "for x in sample_list:\n", 243 | " if x not in exist:\n", 244 | " exist[x] = 1\n", 245 | " else:\n", 246 | " duplicates.append(x)\n", 247 | "print(duplicates)" 248 | ] 249 | }, 250 | { 251 | "cell_type": "raw", 252 | "id": "6f44dcb7-40be-4dcf-be8f-aa501f45f7c0", 253 | "metadata": {}, 254 | "source": [ 255 | "38. Create an outer function that will accept two strings, x and y. (x= 'Emma' and y = 'Kelly'.\n", 256 | "Create an inner function inside an outer function that will concatenate x and y.\n", 257 | "At last, an outer function will join the word 'developer' to it." 258 | ] 259 | }, 260 | { 261 | "cell_type": "code", 262 | "execution_count": 6, 263 | "id": "472a149f-0ceb-48f0-af0c-8953b94813e1", 264 | "metadata": {}, 265 | "outputs": [ 266 | { 267 | "name": "stdout", 268 | "output_type": "stream", 269 | "text": [ 270 | "EmmaKellyDevelopers\n" 271 | ] 272 | } 273 | ], 274 | "source": [ 275 | "def manipulate(x, y):\n", 276 | " # concatenate two strings\n", 277 | " def inner_fun(x, y):\n", 278 | " return x + y\n", 279 | "\n", 280 | " z = inner_fun(x, y)\n", 281 | " return z + 'Developers'\n", 282 | "\n", 283 | "result = manipulate('Emma', 'Kelly')\n", 284 | "print(result)" 285 | ] 286 | }, 287 | { 288 | "cell_type": "raw", 289 | "id": "776550d2-7739-47d3-a39f-39d51dea2dca", 290 | "metadata": {}, 291 | "source": [ 292 | "39.Modify the element of a nested list inside the following list\n", 293 | "Change the element 35 to 3500\n", 294 | "list1 = [5, [10, 15, [20, 25, [30, 35], 40], 45], 50]" 295 | ] 296 | }, 297 | { 298 | "cell_type": "code", 299 | "execution_count": 7, 300 | "id": "858417b9-c6a8-43a9-8bf9-ce264a6a1d15", 301 | "metadata": {}, 302 | "outputs": [ 303 | { 304 | "name": "stdout", 305 | "output_type": "stream", 306 | "text": [ 307 | "[5, [10, 15, [20, 25, [30, 3500], 40], 45], 50]\n" 308 | ] 309 | } 310 | ], 311 | "source": [ 312 | "list1 = [5, [10, 15, [20, 25, [30, 35], 40], 45], 50]\n", 313 | "# modify item\n", 314 | "list1[1][2][2][1] = 3500\n", 315 | "# print final result\n", 316 | "print(list1)\n", 317 | "\n", 318 | "# print(list1[1]) = [10, 15, [20, 25, [30, 400], 40], 45]\n", 319 | "# print(list1[1][2]) = [20, 25, [30, 400], 40]\n", 320 | "# print(list1[1][2][2]) = [30, 40]\n", 321 | "# print(list1[1][2][2][1]) = 40" 322 | ] 323 | }, 324 | { 325 | "cell_type": "raw", 326 | "id": "1401b9a4-52f3-494e-8fc1-8dea8d0c0ced", 327 | "metadata": {}, 328 | "source": [ 329 | "40. Access the nested key increment from the following dictionary\n", 330 | "Access 12\n", 331 | "emp_dict = {\n", 332 | " \"company\": {\n", 333 | " \"employee\": {\n", 334 | " \"name\": \"Jess\",\n", 335 | " \"payable\": {\n", 336 | " \"salary\": 9000,\n", 337 | " \"increment\": 12\n", 338 | " }\n", 339 | " }\n", 340 | " }\n", 341 | "}" 342 | ] 343 | }, 344 | { 345 | "cell_type": "code", 346 | "execution_count": 8, 347 | "id": "e1ad6378-7906-4fcc-beb6-8241755dddb7", 348 | "metadata": {}, 349 | "outputs": [ 350 | { 351 | "name": "stdout", 352 | "output_type": "stream", 353 | "text": [ 354 | "12\n" 355 | ] 356 | } 357 | ], 358 | "source": [ 359 | "emp_dict = {\n", 360 | " \"company\": {\n", 361 | " \"employee\": {\n", 362 | " \"name\": \"Jess\",\n", 363 | " \"payable\": {\n", 364 | " \"salary\": 9000,\n", 365 | " \"increment\": 12\n", 366 | " }\n", 367 | " }\n", 368 | " }\n", 369 | "}\n", 370 | "print(emp_dict['company']['employee']['payable']['increment'])" 371 | ] 372 | }, 373 | { 374 | "cell_type": "raw", 375 | "id": "fd3f1a89-2af6-4614-bbd4-62f884d2a736", 376 | "metadata": {}, 377 | "source": [ 378 | "41. Print the sum of the current number and the previous number\n", 379 | "Write a program to iterate the first 10 numbers and in each iteration, print the sum of the current and previous number.\n", 380 | "Printing current and previous number sum in a range(10)\n", 381 | "Current Number 0 Previous Number 0 Sum: 0\n", 382 | "Current Number 1 Previous Number 0 Sum: 1\n", 383 | "Current Number 2 Previous Number 1 Sum: 3\n", 384 | "Current Number 3 Previous Number 2 Sum: 5\n", 385 | "Current Number 4 Previous Number 3 Sum: 7\n", 386 | "Current Number 5 Previous Number 4 Sum: 9\n", 387 | "Current Number 6 Previous Number 5 Sum: 11\n", 388 | "Current Number 7 Previous Number 6 Sum: 13\n", 389 | "Current Number 8 Previous Number 7 Sum: 15\n", 390 | "Current Number 9 Previous Number 8 Sum: 17" 391 | ] 392 | }, 393 | { 394 | "cell_type": "code", 395 | "execution_count": 9, 396 | "id": "546695ee-9168-4f1e-9e35-4e6a9075d371", 397 | "metadata": {}, 398 | "outputs": [ 399 | { 400 | "name": "stdout", 401 | "output_type": "stream", 402 | "text": [ 403 | "Printing current and previous number and their sum in a range(10)\n", 404 | "Current Number 1 Previous Number 0 Sum: 1\n", 405 | "Current Number 2 Previous Number 1 Sum: 3\n", 406 | "Current Number 3 Previous Number 2 Sum: 5\n", 407 | "Current Number 4 Previous Number 3 Sum: 7\n", 408 | "Current Number 5 Previous Number 4 Sum: 9\n", 409 | "Current Number 6 Previous Number 5 Sum: 11\n", 410 | "Current Number 7 Previous Number 6 Sum: 13\n", 411 | "Current Number 8 Previous Number 7 Sum: 15\n", 412 | "Current Number 9 Previous Number 8 Sum: 17\n", 413 | "Current Number 10 Previous Number 9 Sum: 19\n" 414 | ] 415 | } 416 | ], 417 | "source": [ 418 | "print(\"Printing current and previous number and their sum in a range(10)\")\n", 419 | "previous_num = 0\n", 420 | "\n", 421 | "# loop from 1 to 10\n", 422 | "for i in range(1, 11):\n", 423 | " x_sum = previous_num + i\n", 424 | " print(\"Current Number\", i, \"Previous Number \", previous_num, \" Sum: \", x_sum)\n", 425 | " # modify previous number\n", 426 | " # set it to the current number\n", 427 | " previous_num = i" 428 | ] 429 | }, 430 | { 431 | "cell_type": "raw", 432 | "id": "54573281-c4fd-4d1b-a86d-6c2416558340", 433 | "metadata": {}, 434 | "source": [ 435 | "42.Print characters from a string that are present at an even index number\n", 436 | "Write a program to accept a string from the user and display characters that are present at an even index number.\n", 437 | "\n", 438 | "For example, str = \"ineuron\" so you should display ‘i’, ‘e’, ‘r’, ‘n’." 439 | ] 440 | }, 441 | { 442 | "cell_type": "code", 443 | "execution_count": 10, 444 | "id": "c86b1989-1eb3-4b4d-b09f-ad3299222095", 445 | "metadata": {}, 446 | "outputs": [ 447 | { 448 | "name": "stdin", 449 | "output_type": "stream", 450 | "text": [ 451 | "Enter word ineuron\n" 452 | ] 453 | }, 454 | { 455 | "name": "stdout", 456 | "output_type": "stream", 457 | "text": [ 458 | "Original String: ineuron\n", 459 | "i\n", 460 | "e\n", 461 | "r\n", 462 | "n\n" 463 | ] 464 | } 465 | ], 466 | "source": [ 467 | "# accept input string from a user\n", 468 | "word = input('Enter word ')\n", 469 | "print(\"Original String:\", word)\n", 470 | "\n", 471 | "# using list slicing\n", 472 | "# convert string to list\n", 473 | "# pick only even index chars\n", 474 | "x = list(word)\n", 475 | "for i in x[0::2]:\n", 476 | " print(i)" 477 | ] 478 | }, 479 | { 480 | "cell_type": "code", 481 | "execution_count": 1, 482 | "id": "0e1a4b8f-7ce3-466c-8695-bf6a291834c8", 483 | "metadata": {}, 484 | "outputs": [ 485 | { 486 | "name": "stdout", 487 | "output_type": "stream", 488 | "text": [ 489 | "Enter word ineuron\n", 490 | "Original String: ineuron\n", 491 | "Printing only even index chars\n", 492 | "index[ 0 ] i\n", 493 | "index[ 2 ] e\n", 494 | "index[ 4 ] r\n" 495 | ] 496 | } 497 | ], 498 | "source": [ 499 | "# accept input string from a user\n", 500 | "word = input('Enter word ')\n", 501 | "print(\"Original String:\", word)\n", 502 | "\n", 503 | "# get the length of a string\n", 504 | "size = len(word)\n", 505 | "\n", 506 | "# iterate a each character of a string\n", 507 | "# start: 0 to start with first character\n", 508 | "# stop: size-1 because index starts with 0\n", 509 | "# step: 2 to get the characters present at even index like 0, 2, 4\n", 510 | "print(\"Printing only even index chars\")\n", 511 | "for i in range(0, size - 1, 2):\n", 512 | " print(\"index[\", i, \"]\", word[i])" 513 | ] 514 | }, 515 | { 516 | "cell_type": "raw", 517 | "id": "39874120-4e21-49ac-90dc-ac89219e5616", 518 | "metadata": {}, 519 | "source": [ 520 | "43. Print multiplication table form 1 to 10\n", 521 | "1 2 3 4 5 6 7 8 9 10 \t\t\n", 522 | "2 4 6 8 10 12 14 16 18 20 \t\t\n", 523 | "3 6 9 12 15 18 21 24 27 30 \t\t\n", 524 | "4 8 12 16 20 24 28 32 36 40 \t\t\n", 525 | "5 10 15 20 25 30 35 40 45 50 \t\t\n", 526 | "6 12 18 24 30 36 42 48 54 60 \t\t\n", 527 | "7 14 21 28 35 42 49 56 63 70 \t\t\n", 528 | "8 16 24 32 40 48 56 64 72 80 \t\t\n", 529 | "9 18 27 36 45 54 63 72 81 90 \t\t\n", 530 | "10 20 30 40 50 60 70 80 90 100 " 531 | ] 532 | }, 533 | { 534 | "cell_type": "code", 535 | "execution_count": 12, 536 | "id": "d0c39602-d020-40fe-98c5-ebcfef21db6b", 537 | "metadata": {}, 538 | "outputs": [ 539 | { 540 | "name": "stdout", 541 | "output_type": "stream", 542 | "text": [ 543 | "1 2 3 4 5 6 7 8 9 10 \t\t\n", 544 | "2 4 6 8 10 12 14 16 18 20 \t\t\n", 545 | "3 6 9 12 15 18 21 24 27 30 \t\t\n", 546 | "4 8 12 16 20 24 28 32 36 40 \t\t\n", 547 | "5 10 15 20 25 30 35 40 45 50 \t\t\n", 548 | "6 12 18 24 30 36 42 48 54 60 \t\t\n", 549 | "7 14 21 28 35 42 49 56 63 70 \t\t\n", 550 | "8 16 24 32 40 48 56 64 72 80 \t\t\n", 551 | "9 18 27 36 45 54 63 72 81 90 \t\t\n", 552 | "10 20 30 40 50 60 70 80 90 100 \t\t\n" 553 | ] 554 | } 555 | ], 556 | "source": [ 557 | "for i in range(1, 11):\n", 558 | " for j in range(1, 11):\n", 559 | " print(i * j, end=\" \")\n", 560 | " print(\"\\t\\t\")" 561 | ] 562 | }, 563 | { 564 | "cell_type": "raw", 565 | "id": "18c202be-5c58-483a-b5a2-230b8d45aaaf", 566 | "metadata": {}, 567 | "source": [ 568 | "44.Remove duplicates from a list and create a tuple and find the minimum and maximum number\n", 569 | "sample_list = [87, 45, 41, 65, 94, 41, 99, 94]\n", 570 | "Expected Outcome:\n", 571 | "unique items [87, 45, 41, 65, 99]\n", 572 | "tuple (87, 45, 41, 65, 99)\n", 573 | "min: 41\n", 574 | "max: 99" 575 | ] 576 | }, 577 | { 578 | "cell_type": "code", 579 | "execution_count": 13, 580 | "id": "5489e4cd-8272-49d9-a518-dff92a85ccd7", 581 | "metadata": {}, 582 | "outputs": [ 583 | { 584 | "name": "stdout", 585 | "output_type": "stream", 586 | "text": [ 587 | "Original list [87, 52, 44, 53, 54, 87, 52, 53]\n", 588 | "unique list [44, 52, 53, 54, 87]\n", 589 | "tuple (44, 52, 53, 54, 87)\n", 590 | "Minimum number is: 44\n", 591 | "Maximum number is: 87\n" 592 | ] 593 | } 594 | ], 595 | "source": [ 596 | "sample_list = [87, 52, 44, 53, 54, 87, 52, 53]\n", 597 | "\n", 598 | "print(\"Original list\", sample_list)\n", 599 | "\n", 600 | "sample_list = list(set(sample_list))\n", 601 | "print(\"unique list\", sample_list)\n", 602 | "\n", 603 | "t = tuple(sample_list)\n", 604 | "print(\"tuple \", t)\n", 605 | "\n", 606 | "print(\"Minimum number is: \", min(t))\n", 607 | "print(\"Maximum number is: \", max(t))" 608 | ] 609 | }, 610 | { 611 | "cell_type": "raw", 612 | "id": "11aaf684-145a-4616-af01-13d6f752c6d8", 613 | "metadata": {}, 614 | "source": [ 615 | "45.Write a Python program to create a lambda function that adds 15 to a given number passed in as an argument,\n", 616 | "also create a lambda function that multiplies argument x with argument y and print the result." 617 | ] 618 | }, 619 | { 620 | "cell_type": "raw", 621 | "id": "eb59f1c2-0c87-4bf9-a285-9e9a2d0ead3d", 622 | "metadata": {}, 623 | "source": [ 624 | "lambda arguments : expression\n", 625 | "A lambda function is a small anonymous function.\n", 626 | "\n", 627 | "A lambda function can take any number of arguments, but can only have one expression.\n", 628 | "x = lambda a : a + 10\n", 629 | "print(x(5))" 630 | ] 631 | }, 632 | { 633 | "cell_type": "code", 634 | "execution_count": 14, 635 | "id": "9e2b5d83-ac82-4158-8842-313034fdf1b6", 636 | "metadata": {}, 637 | "outputs": [ 638 | { 639 | "name": "stdout", 640 | "output_type": "stream", 641 | "text": [ 642 | "25\n", 643 | "48\n" 644 | ] 645 | } 646 | ], 647 | "source": [ 648 | "r = lambda a : a + 15\n", 649 | "print(r(10))\n", 650 | "r = lambda x, y : x * y\n", 651 | "print(r(12, 4))" 652 | ] 653 | }, 654 | { 655 | "cell_type": "raw", 656 | "id": "8f213a8a-b6d2-42f5-9ad1-efcd61947820", 657 | "metadata": {}, 658 | "source": [ 659 | "46. Write a Python program to sort a list of tuples using Lambda." 660 | ] 661 | }, 662 | { 663 | "cell_type": "raw", 664 | "id": "64ca5931-6522-4d9f-b459-de1b8fb015ce", 665 | "metadata": {}, 666 | "source": [ 667 | "The sort() method sorts the list ascending by default.\n", 668 | "\n", 669 | "You can also make a function to decide the sorting criteria(s).\n", 670 | "reverse\tOptional. reverse=True will sort the list descending. Default is reverse=False\n", 671 | "key\tOptional. A function to specify the sorting criteria(s)" 672 | ] 673 | }, 674 | { 675 | "cell_type": "code", 676 | "execution_count": 15, 677 | "id": "c7ec471a-be25-4490-a723-1b555677e819", 678 | "metadata": {}, 679 | "outputs": [ 680 | { 681 | "name": "stdout", 682 | "output_type": "stream", 683 | "text": [ 684 | "Original list of tuples:\n", 685 | "[('English', 88), ('Science', 90), ('Maths', 97), ('Social sciences', 82)]\n", 686 | "\n", 687 | "Sorting the List of Tuples:\n", 688 | "[('Social sciences', 82), ('English', 88), ('Science', 90), ('Maths', 97)]\n" 689 | ] 690 | } 691 | ], 692 | "source": [ 693 | "subject_marks = [('English', 88), ('Science', 90), ('Maths', 97), ('Social sciences', 82)]\n", 694 | "print(\"Original list of tuples:\")\n", 695 | "print(subject_marks)\n", 696 | "subject_marks.sort(key = lambda x: x[1])\n", 697 | "print(\"\\nSorting the List of Tuples:\")\n", 698 | "print(subject_marks)" 699 | ] 700 | }, 701 | { 702 | "cell_type": "raw", 703 | "id": "925c39fc-c530-444c-abe6-a85310a46e87", 704 | "metadata": {}, 705 | "source": [ 706 | "47.Write a Python program to extract year, month, date and time using Lambda." 707 | ] 708 | }, 709 | { 710 | "cell_type": "code", 711 | "execution_count": 16, 712 | "id": "31faf027-d040-4678-a561-7133766ce700", 713 | "metadata": {}, 714 | "outputs": [ 715 | { 716 | "name": "stdout", 717 | "output_type": "stream", 718 | "text": [ 719 | "2022-11-18 07:59:55.666221\n", 720 | "2022\n", 721 | "11\n", 722 | "18\n", 723 | "07:59:55.666221\n" 724 | ] 725 | } 726 | ], 727 | "source": [ 728 | "import datetime\n", 729 | "now = datetime.datetime.now()\n", 730 | "print(now)\n", 731 | "year = lambda x: x.year\n", 732 | "month = lambda x: x.month\n", 733 | "day = lambda x: x.day\n", 734 | "t = lambda x: x.time()\n", 735 | "print(year(now))\n", 736 | "print(month(now))\n", 737 | "print(day(now))\n", 738 | "print(t(now))" 739 | ] 740 | }, 741 | { 742 | "cell_type": "raw", 743 | "id": "5f96af34-df6f-4a2d-8414-de28a6c451af", 744 | "metadata": {}, 745 | "source": [ 746 | "48.Write a Python program to count the even, odd numbers in a given array of integers using Lambda." 747 | ] 748 | }, 749 | { 750 | "cell_type": "code", 751 | "execution_count": 17, 752 | "id": "8b6ddb8f-405c-4cb3-b0c6-16436423dd0d", 753 | "metadata": {}, 754 | "outputs": [ 755 | { 756 | "name": "stdout", 757 | "output_type": "stream", 758 | "text": [ 759 | "Original arrays:\n", 760 | "[1, 2, 3, 5, 7, 8, 9, 10]\n", 761 | "\n", 762 | "Number of even numbers in the above array: 3\n", 763 | "\n", 764 | "Number of odd numbers in the above array: 5\n" 765 | ] 766 | } 767 | ], 768 | "source": [ 769 | "array_nums = [1, 2, 3, 5, 7, 8, 9, 10]\n", 770 | "print(\"Original arrays:\")\n", 771 | "print(array_nums)\n", 772 | "odd_ctr = len(list(filter(lambda x: (x%2 != 0) , array_nums)))\n", 773 | "even_ctr = len(list(filter(lambda x: (x%2 == 0) , array_nums)))\n", 774 | "print(\"\\nNumber of even numbers in the above array: \", even_ctr)\n", 775 | "print(\"\\nNumber of odd numbers in the above array: \", odd_ctr)" 776 | ] 777 | }, 778 | { 779 | "cell_type": "raw", 780 | "id": "814a7b7b-0876-438f-b62f-825f67e30383", 781 | "metadata": {}, 782 | "source": [ 783 | "49.Write a Python program to convert all the characters in uppercase and lowercase and eliminate duplicate letters from a given sequence.\n", 784 | "Use map() function." 785 | ] 786 | }, 787 | { 788 | "cell_type": "raw", 789 | "id": "e8fcff7a-3dbd-4052-b9c7-c1b1d92f531b", 790 | "metadata": {}, 791 | "source": [ 792 | "The map() function executes a specified function for each item in an iterable.\n", 793 | "The item is sent to the function as a parameter.\n", 794 | "map(function, iterables)\n", 795 | "def addition(n):\n", 796 | " return n + n\n", 797 | " \n", 798 | "# We double all numbers using map()\n", 799 | "numbers = (1, 2, 3, 4)\n", 800 | "result = map(addition, numbers)\n", 801 | "print(list(result))" 802 | ] 803 | }, 804 | { 805 | "cell_type": "code", 806 | "execution_count": 1, 807 | "id": "6a0eaf4c-e1fd-4d62-ad43-853660fd63e9", 808 | "metadata": {}, 809 | "outputs": [ 810 | { 811 | "name": "stdout", 812 | "output_type": "stream", 813 | "text": [ 814 | "Original Characters:\n", 815 | " {'b', 'o', 'U', 'E', 'i', 'f', 'a'}\n", 816 | "\n", 817 | "After converting above characters in upper and lower cases\n", 818 | "and eliminating duplicate letters:\n", 819 | "{('O', 'o'), ('F', 'f'), ('I', 'i'), ('A', 'a'), ('E', 'e'), ('B', 'b'), ('U', 'u')}\n" 820 | ] 821 | } 822 | ], 823 | "source": [ 824 | "def change_cases(s):\n", 825 | " return str(s).upper(), str(s).lower()\n", 826 | " \n", 827 | "chrars = {'a', 'b', 'E', 'f', 'a', 'i', 'o', 'U', 'a'}\n", 828 | "print(\"Original Characters:\\n\",chrars)\n", 829 | " \n", 830 | "result = map(change_cases, chrars)\n", 831 | "print(\"\\nAfter converting above characters in upper and lower cases\\nand eliminating duplicate letters:\")\n", 832 | "print(set(result))" 833 | ] 834 | }, 835 | { 836 | "cell_type": "raw", 837 | "id": "b2b7308b-184b-4d48-8202-25fcfcefd6d1", 838 | "metadata": {}, 839 | "source": [ 840 | "50. Write a Python program to square the elements of a list using map() function." 841 | ] 842 | }, 843 | { 844 | "cell_type": "code", 845 | "execution_count": 2, 846 | "id": "7ee5d32e-f9d1-4201-9c66-0f1a088a0774", 847 | "metadata": {}, 848 | "outputs": [ 849 | { 850 | "name": "stdout", 851 | "output_type": "stream", 852 | "text": [ 853 | "Original List: [4, 5, 2, 9]\n", 854 | "Square the elements of the said list using map():\n", 855 | "[16, 25, 4, 81]\n" 856 | ] 857 | } 858 | ], 859 | "source": [ 860 | "def square_num(n):\n", 861 | " return n * n\n", 862 | "nums = [4, 5, 2, 9]\n", 863 | "print(\"Original List: \",nums)\n", 864 | "result = map(square_num, nums)\n", 865 | "print(\"Square the elements of the said list using map():\")\n", 866 | "print(list(result))" 867 | ] 868 | } 869 | ], 870 | "metadata": { 871 | "kernelspec": { 872 | "display_name": "Python 3 (ipykernel)", 873 | "language": "python", 874 | "name": "python3" 875 | }, 876 | "language_info": { 877 | "codemirror_mode": { 878 | "name": "ipython", 879 | "version": 3 880 | }, 881 | "file_extension": ".py", 882 | "mimetype": "text/x-python", 883 | "name": "python", 884 | "nbconvert_exporter": "python", 885 | "pygments_lexer": "ipython3", 886 | "version": "3.9.12" 887 | } 888 | }, 889 | "nbformat": 4, 890 | "nbformat_minor": 5 891 | } 892 | -------------------------------------------------------------------------------- /part 1 solutions.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "raw", 5 | "id": "3106f428-97eb-4a8a-ba2b-29a08bb31531", 6 | "metadata": {}, 7 | "source": [ 8 | "1. Print the first 5 positive integers in ascending order with one number \n", 9 | "in each line" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "id": "6f77a70c-da9f-4574-a0bd-6963f2243f43", 16 | "metadata": {}, 17 | "outputs": [ 18 | { 19 | "name": "stdout", 20 | "output_type": "stream", 21 | "text": [ 22 | "1\n", 23 | "2\n", 24 | "3\n", 25 | "4\n", 26 | "5\n" 27 | ] 28 | }, 29 | { 30 | "data": { 31 | "text/plain": [ 32 | "'\\nstart\\tOptional. An integer number specifying at which position to start. Default is 0\\nstop\\tRequired. An integer number specifying at which position to stop (not included).\\nstep\\tOptional. An integer number specifying the incrementation. Default is 1\\n'" 33 | ] 34 | }, 35 | "execution_count": 1, 36 | "metadata": {}, 37 | "output_type": "execute_result" 38 | } 39 | ], 40 | "source": [ 41 | "for i in range(5):\n", 42 | " print(i+1)\n", 43 | " \n", 44 | "# range(start, stop, step)\n", 45 | "# The range() function returns a sequence of numbers, starting from 0 by default, and \n", 46 | "#increments by 1 (by default), and stops before a specified number.\n", 47 | "'''\n", 48 | "start\tOptional. An integer number specifying at which position to start. Default is 0\n", 49 | "stop\tRequired. An integer number specifying at which position to stop (not included).\n", 50 | "step\tOptional. An integer number specifying the incrementation. Default is 1\n", 51 | "'''" 52 | ] 53 | }, 54 | { 55 | "cell_type": "raw", 56 | "id": "714c202e-c57a-4359-9a96-5aa1b83c58ed", 57 | "metadata": {}, 58 | "source": [ 59 | "2. Print the following pattern\n", 60 | "*\n", 61 | "**\n", 62 | "***\n", 63 | "****\n", 64 | "*****\n", 65 | "There are no spaces between consecutive stars. There are no spaces \n", 66 | "at the end of each line.\n" 67 | ] 68 | }, 69 | { 70 | "cell_type": "code", 71 | "execution_count": 3, 72 | "id": "45c166dc-f605-4a1b-8e77-e124c7efc27b", 73 | "metadata": {}, 74 | "outputs": [ 75 | { 76 | "name": "stdout", 77 | "output_type": "stream", 78 | "text": [ 79 | "*\n", 80 | "**\n", 81 | "***\n", 82 | "****\n", 83 | "*****\n" 84 | ] 85 | } 86 | ], 87 | "source": [ 88 | "for i in range (1,6):\n", 89 | " for j in range(1,i+1):\n", 90 | " print(\"*\",end = '')\n", 91 | " print()" 92 | ] 93 | }, 94 | { 95 | "cell_type": "raw", 96 | "id": "74a8caa3-e9e9-4ca3-8a42-4ca8f4b9b301", 97 | "metadata": {}, 98 | "source": [ 99 | "3. Accept an integer as input and print its square as output." 100 | ] 101 | }, 102 | { 103 | "cell_type": "code", 104 | "execution_count": 4, 105 | "id": "0cc841e6-9c35-4683-b332-9d06c30d0925", 106 | "metadata": {}, 107 | "outputs": [ 108 | { 109 | "name": "stdin", 110 | "output_type": "stream", 111 | "text": [ 112 | " 2\n" 113 | ] 114 | }, 115 | { 116 | "name": "stdout", 117 | "output_type": "stream", 118 | "text": [ 119 | "4\n" 120 | ] 121 | } 122 | ], 123 | "source": [ 124 | "n = int(input())\n", 125 | "print(n**2)" 126 | ] 127 | }, 128 | { 129 | "cell_type": "raw", 130 | "id": "0f8f5b38-a5b2-4604-817b-5716f5b045bf", 131 | "metadata": {}, 132 | "source": [ 133 | "4.Accept two integers as input and print their sum as output." 134 | ] 135 | }, 136 | { 137 | "cell_type": "code", 138 | "execution_count": 5, 139 | "id": "b833076e-964f-47d4-98ba-9801105d7d38", 140 | "metadata": {}, 141 | "outputs": [ 142 | { 143 | "name": "stdin", 144 | "output_type": "stream", 145 | "text": [ 146 | " 3\n", 147 | " 4\n" 148 | ] 149 | }, 150 | { 151 | "name": "stdout", 152 | "output_type": "stream", 153 | "text": [ 154 | "7\n" 155 | ] 156 | } 157 | ], 158 | "source": [ 159 | "a = int(input())\n", 160 | "b = int(input())\n", 161 | "print(a+b)" 162 | ] 163 | }, 164 | { 165 | "cell_type": "raw", 166 | "id": "3e4707d1-6667-4dbf-8f36-b5033dc862af", 167 | "metadata": {}, 168 | "source": [ 169 | "5. Accept two words as input and print the two words after adding a \n", 170 | "space between them" 171 | ] 172 | }, 173 | { 174 | "cell_type": "code", 175 | "execution_count": 7, 176 | "id": "f87e42e3-9f06-4045-90f1-c8cf6f7c1f42", 177 | "metadata": {}, 178 | "outputs": [ 179 | { 180 | "name": "stdin", 181 | "output_type": "stream", 182 | "text": [ 183 | " ineuron\n", 184 | " ineuron\n" 185 | ] 186 | }, 187 | { 188 | "name": "stdout", 189 | "output_type": "stream", 190 | "text": [ 191 | "ineuron ineuron\n" 192 | ] 193 | } 194 | ], 195 | "source": [ 196 | "print(input(), input())" 197 | ] 198 | }, 199 | { 200 | "cell_type": "raw", 201 | "id": "335f880d-0151-4f82-a944-43ce7a672e07", 202 | "metadata": {}, 203 | "source": [ 204 | "6. Accept the registration number of a vehicle as input and print its \n", 205 | "state-code as output." 206 | ] 207 | }, 208 | { 209 | "cell_type": "code", 210 | "execution_count": 8, 211 | "id": "4038ade9-29c7-4afc-b441-f7e52f0bbc4f", 212 | "metadata": {}, 213 | "outputs": [ 214 | { 215 | "name": "stdin", 216 | "output_type": "stream", 217 | "text": [ 218 | " ka042367\n" 219 | ] 220 | }, 221 | { 222 | "name": "stdout", 223 | "output_type": "stream", 224 | "text": [ 225 | "ka\n" 226 | ] 227 | } 228 | ], 229 | "source": [ 230 | "s = input()\n", 231 | "print(s[0:2])" 232 | ] 233 | }, 234 | { 235 | "cell_type": "raw", 236 | "id": "bf8f8f8f-a91d-4f35-8d4b-c45026aa9925", 237 | "metadata": {}, 238 | "source": [ 239 | "7. Accept a five-digit number as input and print the sum of its digits as \n", 240 | "output." 241 | ] 242 | }, 243 | { 244 | "cell_type": "code", 245 | "execution_count": 10, 246 | "id": "18e780b0-875b-4a17-8773-ceaa627c4d8d", 247 | "metadata": {}, 248 | "outputs": [ 249 | { 250 | "name": "stdin", 251 | "output_type": "stream", 252 | "text": [ 253 | " 12345\n" 254 | ] 255 | }, 256 | { 257 | "name": "stdout", 258 | "output_type": "stream", 259 | "text": [ 260 | "15\n" 261 | ] 262 | } 263 | ], 264 | "source": [ 265 | "num = input()\n", 266 | "d1 = int(num[0])\n", 267 | "d2 = int(num[1])\n", 268 | "d3 = int(num[2])\n", 269 | "d4 = int(num[3])\n", 270 | "d5 = int(num[4])\n", 271 | "dsum = d1 + d2 + d3 + d4 + d5\n", 272 | "print(dsum)" 273 | ] 274 | }, 275 | { 276 | "cell_type": "raw", 277 | "id": "1eb45d9d-3cd1-4032-88b5-8c7d9084a8c0", 278 | "metadata": {}, 279 | "source": [ 280 | "8.Accept five words as input and print the sentence formed by these \n", 281 | "words after adding a space between consecutive words and a full stop \n", 282 | "at the end.\n" 283 | ] 284 | }, 285 | { 286 | "cell_type": "code", 287 | "execution_count": 12, 288 | "id": "29988a9b-d88e-4123-a8d5-d5603fa087fd", 289 | "metadata": {}, 290 | "outputs": [ 291 | { 292 | "name": "stdin", 293 | "output_type": "stream", 294 | "text": [ 295 | " i\n", 296 | " write\n", 297 | " code\n", 298 | " in\n", 299 | " ineuron\n" 300 | ] 301 | }, 302 | { 303 | "name": "stdout", 304 | "output_type": "stream", 305 | "text": [ 306 | "i write code in ineuron.\n" 307 | ] 308 | } 309 | ], 310 | "source": [ 311 | "word1 = input()\n", 312 | "word2 = input()\n", 313 | "word3 = input()\n", 314 | "word4 = input()\n", 315 | "word5 = input()\n", 316 | "space = ' '\n", 317 | "stop = '.'\n", 318 | "sentence = word1 + space + word2 + space + word3 + space + word4 + space + word5 + stop\n", 319 | "print(sentence)" 320 | ] 321 | }, 322 | { 323 | "cell_type": "raw", 324 | "id": "40355f41-2312-402b-85ab-da35417fbcd8", 325 | "metadata": {}, 326 | "source": [ 327 | "9.Accept the date in DD-MM-YYYY format as input and print the \n", 328 | "year as output." 329 | ] 330 | }, 331 | { 332 | "cell_type": "code", 333 | "execution_count": 13, 334 | "id": "b9e9fbad-a792-4d94-a15d-b5d5815830bc", 335 | "metadata": {}, 336 | "outputs": [ 337 | { 338 | "name": "stdin", 339 | "output_type": "stream", 340 | "text": [ 341 | " 20-01-1993\n" 342 | ] 343 | }, 344 | { 345 | "name": "stdout", 346 | "output_type": "stream", 347 | "text": [ 348 | "1993\n" 349 | ] 350 | } 351 | ], 352 | "source": [ 353 | "date = input()\n", 354 | "year = date[-4: ]\n", 355 | "print(year)" 356 | ] 357 | }, 358 | { 359 | "cell_type": "raw", 360 | "id": "f7fe64ce-ab30-4f78-9722-e6ebdac1f34b", 361 | "metadata": {}, 362 | "source": [ 363 | "10.Accept a sequence of five single digit numbers separated by commas \n", 364 | "as input. Print the product of all five numbers.\n" 365 | ] 366 | }, 367 | { 368 | "cell_type": "code", 369 | "execution_count": null, 370 | "id": "cb49b55f-fbd8-43a0-a396-4e9e53548f77", 371 | "metadata": {}, 372 | "outputs": [], 373 | "source": [ 374 | "num = input()\n", 375 | "d1 = int(num[0])\n", 376 | "d2 = int(num[2])\n", 377 | "d3 = int(num[4])\n", 378 | "d4 = int(num[6])\n", 379 | "d5 = int(num[8])\n", 380 | "dprod = d1 * d2 * d3 * d4 * d5\n", 381 | "print(dprod)\n" 382 | ] 383 | }, 384 | { 385 | "cell_type": "raw", 386 | "id": "917b0c37-483a-4187-808b-c12eb234c5ed", 387 | "metadata": {}, 388 | "source": [ 389 | "11. Accept two positive integers x and y as input. Print the number of \n", 390 | "digits in xy" 391 | ] 392 | }, 393 | { 394 | "cell_type": "code", 395 | "execution_count": 3, 396 | "id": "3da90707-82ff-4566-a221-07d1dcb010ba", 397 | "metadata": {}, 398 | "outputs": [ 399 | { 400 | "name": "stdin", 401 | "output_type": "stream", 402 | "text": [ 403 | " 5\n", 404 | " 7\n" 405 | ] 406 | }, 407 | { 408 | "name": "stdout", 409 | "output_type": "stream", 410 | "text": [ 411 | "5\n" 412 | ] 413 | } 414 | ], 415 | "source": [ 416 | "x = int(input())\n", 417 | "y = int(input())\n", 418 | "res = x ** y\n", 419 | "res_str = str(res)\n", 420 | "print(len(res_str))\n" 421 | ] 422 | }, 423 | { 424 | "cell_type": "raw", 425 | "id": "137f8cf1-c13c-4429-b2c8-fde244a54c65", 426 | "metadata": {}, 427 | "source": [ 428 | "12. Accept a string as input. If the input string is of odd length, then \n", 429 | "continue with it. If the input string is of even length, make the \n", 430 | "string of odd length as below:\n", 431 | "• If the last character is a period (.), then remove it \n", 432 | "• If the last character is not a period, then add a period (.) to the \n", 433 | "end of the string\n", 434 | "Call this string of odd length word. Select a substring made up of \n", 435 | "three consecutive characters from word such that there are an \n", 436 | "equal number of characters to the left and right of this substring. \n", 437 | "Print this substring as output. You can assume that all input \n", 438 | "strings will be in lower case and will have a length of at least four" 439 | ] 440 | }, 441 | { 442 | "cell_type": "code", 443 | "execution_count": 2, 444 | "id": "f6285384-b00e-4dca-8d12-d6e84f6923a7", 445 | "metadata": {}, 446 | "outputs": [ 447 | { 448 | "name": "stdin", 449 | "output_type": "stream", 450 | "text": [ 451 | " welcome\n" 452 | ] 453 | }, 454 | { 455 | "name": "stdout", 456 | "output_type": "stream", 457 | "text": [ 458 | "lco\n" 459 | ] 460 | } 461 | ], 462 | "source": [ 463 | "s = input()\n", 464 | "n = len(s)\n", 465 | "if n%2 == 0:\n", 466 | " if s[n-1]=='.':\n", 467 | " s=s[:-1]\n", 468 | " else:\n", 469 | " s=s+'.'\n", 470 | "n = int((len(s)-1)/2)\n", 471 | "print(s[n-1: n+2])" 472 | ] 473 | }, 474 | { 475 | "cell_type": "raw", 476 | "id": "2eb68eb6-7f88-42e7-b84c-b12fa2a926ba", 477 | "metadata": {}, 478 | "source": [ 479 | "13. Accept three positive integers as input and check if they form the \n", 480 | "sides of a right triangle. Print YES if they form one, and NO is they do \n", 481 | "not. The input will have three lines, with one integer on each line. \n", 482 | "The output should be a single line containing one of these two \n", 483 | "strings: YES or NO." 484 | ] 485 | }, 486 | { 487 | "cell_type": "code", 488 | "execution_count": 9, 489 | "id": "e804bb8c-5e0c-4e25-ae2d-c829dc7a3c19", 490 | "metadata": {}, 491 | "outputs": [ 492 | { 493 | "name": "stdin", 494 | "output_type": "stream", 495 | "text": [ 496 | " 3\n", 497 | " 4\n", 498 | " 5\n" 499 | ] 500 | }, 501 | { 502 | "name": "stdout", 503 | "output_type": "stream", 504 | "text": [ 505 | "YES\n" 506 | ] 507 | } 508 | ], 509 | "source": [ 510 | "x = int(input())\n", 511 | "y = int(input())\n", 512 | "z = int(input())\n", 513 | "# There are three possible conditions\n", 514 | "# We are combining them using the \"or\" operator\n", 515 | "if ((x ** 2 + y ** 2 == z ** 2) or\n", 516 | " (y ** 2 + z ** 2 == x ** 2) or\n", 517 | " (z ** 2 + x ** 2 == y ** 2)):\n", 518 | " print('YES')\n", 519 | "else:\n", 520 | " print('NO')\n" 521 | ] 522 | }, 523 | { 524 | "cell_type": "raw", 525 | "id": "6b647411-3285-4bab-acbf-0e375eb527de", 526 | "metadata": {}, 527 | "source": [ 528 | "14. EvenOdd is a tech startup. Each employee at the startup is given an employee id which is a unique \n", 529 | "positive integer. On one warm Sunday evening, five employees of the company come together for a \n", 530 | "meeting and sit at a circular table:\n", 531 | "The employees follow a strange convention. They will continue the meeting only if the following \n", 532 | "condition is satisfied.\n", 533 | "The sum of the employee-ids of every pair of adjacent employees at the table must be an even \n", 534 | "number.\n", 535 | "They are so lazy that they won’t move around to satisfy the above condition, If the current seating \n", 536 | "plan doesn’t satisfy the condition, the meeting will be cancelled. You are given the employee-id of all \n", 537 | "five employees. Your task is to decide if the meeting happened or not.\n", 538 | "The input will be five lined, each containing an integer. The ith line will have the employee-id of Ei. \n", 539 | "The output will be a single line containing one of these two strings: YES or NO" 540 | ] 541 | }, 542 | { 543 | "cell_type": "code", 544 | "execution_count": 12, 545 | "id": "5a3bc35b-8cd9-4dd2-90ad-0a5a417de597", 546 | "metadata": {}, 547 | "outputs": [ 548 | { 549 | "name": "stdin", 550 | "output_type": "stream", 551 | "text": [ 552 | " 1\n", 553 | " 2\n", 554 | " 4\n", 555 | " 6\n", 556 | " 8\n" 557 | ] 558 | }, 559 | { 560 | "name": "stdout", 561 | "output_type": "stream", 562 | "text": [ 563 | "NO\n" 564 | ] 565 | } 566 | ], 567 | "source": [ 568 | "e1 = int(input())\n", 569 | "e2 = int(input())\n", 570 | "e3 = int(input())\n", 571 | "e4 = int(input())\n", 572 | "e5 = int(input())\n", 573 | "# Check if the sum is odd for each pair of adjacent employees\n", 574 | "if (e1 + e2) % 2 != 0:\n", 575 | " print('NO')\n", 576 | "elif (e2 + e3) % 2 != 0:\n", 577 | " print('NO')\n", 578 | "elif (e3 + e4) % 2 != 0:\n", 579 | " print('NO')\n", 580 | "elif (e4 + e5) % 2 != 0:\n", 581 | " print('NO')\n", 582 | "elif (e5 + e1) % 2 != 0:\n", 583 | " print('NO')\n", 584 | "# If the sum is even for every pair of adjacent employees,\n", 585 | "# then the else block gets executed\n", 586 | "else:\n", 587 | " print('YES')\n" 588 | ] 589 | }, 590 | { 591 | "cell_type": "raw", 592 | "id": "8735be04-6021-4972-beac-a4768251a9c0", 593 | "metadata": {}, 594 | "source": [ 595 | "15. Accept a string as input and print the vowels present in the string in \n", 596 | "alphabetical order. If the string doesn’t contain any vowels, then \n", 597 | "print the string none as output. Each vowel that appears in the input \n", 598 | "string – irrespective of its case should appear just once in lower case \n", 599 | "in the output" 600 | ] 601 | }, 602 | { 603 | "cell_type": "code", 604 | "execution_count": 18, 605 | "id": "a4199de1-a75f-4ae8-873e-97eee7fdf9ee", 606 | "metadata": {}, 607 | "outputs": [ 608 | { 609 | "name": "stdin", 610 | "output_type": "stream", 611 | "text": [ 612 | " szl\n" 613 | ] 614 | }, 615 | { 616 | "name": "stdout", 617 | "output_type": "stream", 618 | "text": [ 619 | "none\n" 620 | ] 621 | } 622 | ], 623 | "source": [ 624 | "input_string = input().lower()\n", 625 | "vowels = \"\"\n", 626 | "if \"a\" in input_string:\n", 627 | " vowels += \"a\"\n", 628 | "if \"e\" in input_string:\n", 629 | " vowels += \"e\"\n", 630 | "if \"i\" in input_string:\n", 631 | " vowels += \"i\"\n", 632 | "if \"o\" in input_string:\n", 633 | " vowels += \"o\"\n", 634 | "if \"u\" in input_string:\n", 635 | " vowels += \"u\"\n", 636 | "# check if vowels is non-empty\n", 637 | "if vowels != \"\":\n", 638 | " print(vowels)\n", 639 | "else:\n", 640 | " print('none')\n" 641 | ] 642 | }, 643 | { 644 | "cell_type": "raw", 645 | "id": "16eaadbe-88c3-4d5e-ac14-ee27bdccbf88", 646 | "metadata": {}, 647 | "source": [ 648 | "16.You are given the date of birth of two persons, not necessarily from \n", 649 | "the same family. Your task is to find the younger of the two. If both \n", 650 | "of them share the same date of birth, then the younger of the two is \n", 651 | "assumed to be that person whose name comes first in alphabetical \n", 652 | "order.\n", 653 | "The input will have four lines. The first two lines correspond to the \n", 654 | "first person, while the last two lines correspond to the second \n", 655 | "person. For each person, the first line corresponds to the name and \n", 656 | "the second line corresponds to the date of birth in “DD-MM-YYYY” \n", 657 | "format. Your output should be the name of the younger of the two.\n" 658 | ] 659 | }, 660 | { 661 | "cell_type": "code", 662 | "execution_count": 20, 663 | "id": "20c85aab-386c-4beb-91f8-4f692b1341b6", 664 | "metadata": {}, 665 | "outputs": [ 666 | { 667 | "name": "stdin", 668 | "output_type": "stream", 669 | "text": [ 670 | " imran\n", 671 | " 20-01-1993\n", 672 | " salina\n", 673 | " 21-01-2003\n" 674 | ] 675 | }, 676 | { 677 | "name": "stdout", 678 | "output_type": "stream", 679 | "text": [ 680 | "salina\n" 681 | ] 682 | } 683 | ], 684 | "source": [ 685 | "n1 = input()\n", 686 | "d1 = input()\n", 687 | "n2 = input()\n", 688 | "d2 = input()\n", 689 | "if d1==d2 :\n", 690 | " if n15 and n.isdigit():\n", 922 | " for i in range(10):\n", 923 | " if n.count(n[i])<8:\n", 924 | " a=True\n", 925 | " if n[i]*6 in n:\n", 926 | " a=False\n", 927 | " break\n", 928 | " else:\n", 929 | " break\n", 930 | "if a:\n", 931 | " print('valid')\n", 932 | "else:\n", 933 | " print('invalid')\n", 934 | "\n", 935 | "#The isdigit() method returns True if all the characters are digits, otherwise False.\n", 936 | "# The count() method returns the number of elements with the specified value." 937 | ] 938 | }, 939 | { 940 | "cell_type": "raw", 941 | "id": "58804174-f22a-49b2-8228-8f32a64a0ac7", 942 | "metadata": {}, 943 | "source": [ 944 | "22. In the first line of input, accept a sequence of space-separated words. In the second line of \n", 945 | "input, accept a single word. If this word is not present in the sequence, print NO. If this word \n", 946 | "is present in the sequence, then print YES and in the next line of the output, print the number \n", 947 | "of times the word appears in the sequence." 948 | ] 949 | }, 950 | { 951 | "cell_type": "code", 952 | "execution_count": 2, 953 | "id": "e0296246-0feb-4759-82c6-6520523a3f06", 954 | "metadata": {}, 955 | "outputs": [ 956 | { 957 | "name": "stdin", 958 | "output_type": "stream", 959 | "text": [ 960 | " i love code i write code in ineuron\n", 961 | " code\n" 962 | ] 963 | }, 964 | { 965 | "name": "stdout", 966 | "output_type": "stream", 967 | "text": [ 968 | "YES\n", 969 | "2\n" 970 | ] 971 | } 972 | ], 973 | "source": [ 974 | "s=input().split(' ')\n", 975 | "a=input()\n", 976 | "if a in s:\n", 977 | " print('YES')\n", 978 | " print(s.count(a))\n", 979 | "else:\n", 980 | " print('NO')\n", 981 | "#string.split(separator, maxsplit)\n", 982 | "#The split() method splits a string into a list.\n" 983 | ] 984 | }, 985 | { 986 | "cell_type": "raw", 987 | "id": "0210f181-ddb9-4fb9-a9ec-31573c173f4b", 988 | "metadata": {}, 989 | "source": [ 990 | "23. Write a function named factorial that accepts an integer n as argument. It should return \n", 991 | "the factorial of n if n is a positive integer. It should return -1 if n is a negative integer, and it \n", 992 | "should return 1 if n is zero." 993 | ] 994 | }, 995 | { 996 | "cell_type": "code", 997 | "execution_count": 6, 998 | "id": "6da765bd-323c-4ef2-8e8f-c71e04e52bcd", 999 | "metadata": {}, 1000 | "outputs": [], 1001 | "source": [ 1002 | "def factorial(n):\n", 1003 | " if n<0:\n", 1004 | " return -1\n", 1005 | " elif n==0:\n", 1006 | " return 1\n", 1007 | " else:\n", 1008 | " f=1\n", 1009 | " for i in range(1,n+1):\n", 1010 | " f*=i\n", 1011 | " return f\n" 1012 | ] 1013 | }, 1014 | { 1015 | "cell_type": "code", 1016 | "execution_count": 7, 1017 | "id": "d3ffc281-ef70-4017-a95b-baa0edbf8c6a", 1018 | "metadata": {}, 1019 | "outputs": [ 1020 | { 1021 | "data": { 1022 | "text/plain": [ 1023 | "6" 1024 | ] 1025 | }, 1026 | "execution_count": 7, 1027 | "metadata": {}, 1028 | "output_type": "execute_result" 1029 | } 1030 | ], 1031 | "source": [ 1032 | "factorial(3)" 1033 | ] 1034 | }, 1035 | { 1036 | "cell_type": "raw", 1037 | "id": "4f647376-0565-45e3-9239-8c57ed0c9d51", 1038 | "metadata": {}, 1039 | "source": [ 1040 | "24. \n", 1041 | "The range of a list of numbers is the difference between the maximum and minimum values in the list\n", 1042 | "\n", 1043 | "Write a function named get_range that accepts a non-empty list of real numbers as argument. It \n", 1044 | "should return the range of the list.\n", 1045 | "(1) Avoid using built-in function such as max and min.\n", 1046 | "(2) You do not have to accept input from the user or print output to the console. You just have to write \n", 1047 | "the function definition.\n" 1048 | ] 1049 | }, 1050 | { 1051 | "cell_type": "code", 1052 | "execution_count": 8, 1053 | "id": "fb7b1a39-96bd-4dbd-a553-c40c84aae1ae", 1054 | "metadata": {}, 1055 | "outputs": [], 1056 | "source": [ 1057 | "# get the maximum\n", 1058 | "def get_max(L):\n", 1059 | " maxi = L[0]\n", 1060 | " for x in L:\n", 1061 | " if x > maxi:\n", 1062 | " maxi = x\n", 1063 | " return maxi\n", 1064 | "# get the minimum\n", 1065 | "def get_min(L):\n", 1066 | " mini = L[0]\n", 1067 | " for x in L:\n", 1068 | " if x < mini:\n", 1069 | " mini = x\n", 1070 | " return mini\n", 1071 | "# get the range\n", 1072 | "def get_range(L):\n", 1073 | " maxi = get_max(L)\n", 1074 | " mini = get_min(L)\n", 1075 | " return maxi - mini \n" 1076 | ] 1077 | }, 1078 | { 1079 | "cell_type": "code", 1080 | "execution_count": 10, 1081 | "id": "1e10fb65-1ede-4b2c-a9a0-feaf660d9591", 1082 | "metadata": {}, 1083 | "outputs": [ 1084 | { 1085 | "data": { 1086 | "text/plain": [ 1087 | "9" 1088 | ] 1089 | }, 1090 | "execution_count": 10, 1091 | "metadata": {}, 1092 | "output_type": "execute_result" 1093 | } 1094 | ], 1095 | "source": [ 1096 | "get_range([1,2,3,4,10])" 1097 | ] 1098 | }, 1099 | { 1100 | "cell_type": "raw", 1101 | "id": "3863662f-b849-49c8-b60c-be516d8533a5", 1102 | "metadata": {}, 1103 | "source": [ 1104 | "25. Write a function named read_file that accepts a text file named filename as argument. Within \n", 1105 | "the function, read the file and print each line of the file on a separate line in the console. You shouldn't \n", 1106 | "print any extra characters at the end of a line. There shouldn't be an empty line between any two \n", 1107 | "consecutive lines.\n", 1108 | "(1) filename is a string variable that holds the name of the file. For example, in the first test case, it \n", 1109 | "is filename = 'public_1.txt'.\n", 1110 | "(2) You do not have to accept input from the console. You have to write the function definition and \n", 1111 | "print the contents of the file within the function\n", 1112 | "\n", 1113 | "#The strip() method removes any leading (spaces at the beginning) and trailing (spaces at the end) characters (space is the default leading character to remove)" 1114 | ] 1115 | }, 1116 | { 1117 | "cell_type": "code", 1118 | "execution_count": 16, 1119 | "id": "ffcbbc9e-1dfc-4497-8b79-9ca540784448", 1120 | "metadata": {}, 1121 | "outputs": [], 1122 | "source": [ 1123 | "def read_file(filename):\n", 1124 | " f = open(filename, 'r')\n", 1125 | " for line in f:\n", 1126 | " print(line.strip())\n", 1127 | " f.close()" 1128 | ] 1129 | }, 1130 | { 1131 | "cell_type": "code", 1132 | "execution_count": 18, 1133 | "id": "fe01e2b2-9074-4125-8868-4dce8e5fd5b9", 1134 | "metadata": {}, 1135 | "outputs": [ 1136 | { 1137 | "name": "stdout", 1138 | "output_type": "stream", 1139 | "text": [ 1140 | "hello\n", 1141 | "i\n", 1142 | "write\n", 1143 | "code\n" 1144 | ] 1145 | } 1146 | ], 1147 | "source": [ 1148 | "read_file('public.txt')" 1149 | ] 1150 | }, 1151 | { 1152 | "cell_type": "raw", 1153 | "id": "7f3595c3-3996-4eff-8260-badb1aab645d", 1154 | "metadata": {}, 1155 | "source": [ 1156 | "26. A simple algorithm has to be designed to find out whether a student \n", 1157 | "belongs to the Data Science branch or not. The input will be a \n", 1158 | "student's roll number, which is of the form BR18B0000. \n", 1159 | "Here, BR represents the branch code, 18 represents the year of \n", 1160 | "joining, B represents the education level and 0000 represents the \n", 1161 | "specific identification given to the student of that batch. The branch \n", 1162 | "code for Data Science is DS. Print True if the student belongs to \n", 1163 | "Data Science branch and False otherwise." 1164 | ] 1165 | }, 1166 | { 1167 | "cell_type": "code", 1168 | "execution_count": 20, 1169 | "id": "b53a2567-c668-4f6f-981c-60b6727d0ebd", 1170 | "metadata": {}, 1171 | "outputs": [ 1172 | { 1173 | "name": "stdin", 1174 | "output_type": "stream", 1175 | "text": [ 1176 | " DS1nc12ec049\n" 1177 | ] 1178 | }, 1179 | { 1180 | "name": "stdout", 1181 | "output_type": "stream", 1182 | "text": [ 1183 | "True\n" 1184 | ] 1185 | } 1186 | ], 1187 | "source": [ 1188 | "s = input()\n", 1189 | "if s[0]=='D' and s[1]=='S':\n", 1190 | " print(\"True\")\n", 1191 | "else:\n", 1192 | " print(\"False\")\n" 1193 | ] 1194 | }, 1195 | { 1196 | "cell_type": "raw", 1197 | "id": "f587b583-a53e-4fb8-b2da-5c48aa841576", 1198 | "metadata": {}, 1199 | "source": [ 1200 | "27.The police are trying to track a criminal based on the evidence \n", 1201 | "available at a crime site. Their main clue is a vehicle's damaged \n", 1202 | "number plate. Only the string TN07 is visible. The format of the \n", 1203 | "registration number is AA00AA00, where the first two letters are \n", 1204 | "alphabets, next two are numbers, next two are again alphabets \n", 1205 | "followed by two numbers at the end. A number plate is picked from a \n", 1206 | "database of registration numbers and is given to you as input. Your \n", 1207 | "task is to determine if this could belong to the criminal or not. \n", 1208 | "Print True if the number plate \n", 1209 | "contains TN07 and False otherwise.\n" 1210 | ] 1211 | }, 1212 | { 1213 | "cell_type": "code", 1214 | "execution_count": null, 1215 | "id": "e4e8ae43-e186-4456-9136-212a7805ba56", 1216 | "metadata": {}, 1217 | "outputs": [], 1218 | "source": [ 1219 | "n=input()\n", 1220 | "if (n[0:4]=='TN07') or (n[4:8]=='TN07'):\n", 1221 | " print('True')\n", 1222 | "else:\n", 1223 | " print('False')\n" 1224 | ] 1225 | }, 1226 | { 1227 | "cell_type": "raw", 1228 | "id": "bcf855ad-2978-44fe-bf2a-d86330692535", 1229 | "metadata": {}, 1230 | "source": [ 1231 | "28. You are given a string and two non-negative integers as input. The \n", 1232 | "two integers specify the start and end indices of a substring in the \n", 1233 | "given string. Create a new string by replicating the substring a \n", 1234 | "minimum number of times so that the resulting string is longer than \n", 1235 | "the input string. The input parameters are the string, start index of \n", 1236 | "the substring and the end index of substring (endpoints inclusive) \n", 1237 | "each on a different line." 1238 | ] 1239 | }, 1240 | { 1241 | "cell_type": "code", 1242 | "execution_count": 13, 1243 | "id": "a31c768c-3b90-43c1-bcd5-a79513fde8c9", 1244 | "metadata": {}, 1245 | "outputs": [ 1246 | { 1247 | "name": "stdin", 1248 | "output_type": "stream", 1249 | "text": [ 1250 | " code\n", 1251 | " 2\n", 1252 | " 3\n" 1253 | ] 1254 | }, 1255 | { 1256 | "name": "stdout", 1257 | "output_type": "stream", 1258 | "text": [ 1259 | "dedede\n" 1260 | ] 1261 | } 1262 | ], 1263 | "source": [ 1264 | "n=input()\n", 1265 | "a=int(input())\n", 1266 | "b=int(input())\n", 1267 | "x=n[a:b+1]\n", 1268 | "y=len(n)\n", 1269 | "ans=\"\"\n", 1270 | "while(y>=len(ans)):\n", 1271 | " ans+=x\n", 1272 | " \n", 1273 | "print(ans)\n" 1274 | ] 1275 | }, 1276 | { 1277 | "cell_type": "raw", 1278 | "id": "1c661244-0297-4d14-8196-36f1005affe7", 1279 | "metadata": {}, 1280 | "source": [ 1281 | "29. A class teacher has decided to split her entire class into four groups, namely Sapphire, Peridot, Ruby, \n", 1282 | "and Emerald for sports competitions. For dividing the students into these four groups, she has \n", 1283 | "followed the pattern given below:\n", 1284 | "Sapphire - 1, 5, 9, 13, 17, 21, ...\n", 1285 | "Peridot - 2, 6, 10, 14, 18, 22, ...\n", 1286 | "Ruby - 3, 7, 11, 15, 19, 23, ...\n", 1287 | "Emerald - 4, 8, 12, 16, 20, 24, ...\n", 1288 | "All the students are represented by their roll numbers. Based on the above pattern, given the roll \n", 1289 | "number as input, print the group the student belongs to. Note that the roll number can be any \n", 1290 | "positive integer and not necessarily less than 25.\n", 1291 | "\n", 1292 | "\n", 1293 | "range(start, stop, step)\n", 1294 | "start\tOptional. An integer number specifying at which position to start. Default is 0\n", 1295 | "stop\tRequired. An integer number specifying at which position to stop (not included).\n", 1296 | "step\tOptional. An integer number specifying the incrementation. Default is 1" 1297 | ] 1298 | }, 1299 | { 1300 | "cell_type": "code", 1301 | "execution_count": 22, 1302 | "id": "37f823e4-aafe-492d-a56c-d993908f3cb3", 1303 | "metadata": {}, 1304 | "outputs": [ 1305 | { 1306 | "name": "stdin", 1307 | "output_type": "stream", 1308 | "text": [ 1309 | " 22\n" 1310 | ] 1311 | }, 1312 | { 1313 | "name": "stdout", 1314 | "output_type": "stream", 1315 | "text": [ 1316 | "Peridot\n" 1317 | ] 1318 | } 1319 | ], 1320 | "source": [ 1321 | "n=int(input())\n", 1322 | "for i in range(1,n+1,4):\n", 1323 | " if n==i:\n", 1324 | " print('Sapphire')\n", 1325 | "for j in range(2,n+1,4):\n", 1326 | " if n==j:\n", 1327 | " print('Peridot')\n", 1328 | "for k in range(3,n+1,4):\n", 1329 | " if n==k:\n", 1330 | " print('Ruby')\n", 1331 | "for l in range(4,n+1,4):\n", 1332 | " if n==l:\n", 1333 | " print('Emerald')\n" 1334 | ] 1335 | }, 1336 | { 1337 | "cell_type": "raw", 1338 | "id": "0a8af592-df26-4978-a36c-fd728f2ef086", 1339 | "metadata": {}, 1340 | "source": [ 1341 | "30. A data science company wants to hire data scientists from abc college. \n", 1342 | "The company follows a certain criteria for selection: for a student to \n", 1343 | "be selected, the number of backlogs should be at most 5 and the \n", 1344 | "CGPA (Cumulative Grade Point Average) should be greater than 6. If \n", 1345 | "the student does not fit the above criteria, then the student is not \n", 1346 | "offered the job. If the student is selected, then the salary offered is \n", 1347 | "equal to 5 times his/her CGPA (in lakhs).\n", 1348 | "Accept the number of backlogs (integer) and the CGPA (float) of the \n", 1349 | "student as input. Your task is to determine if the student is selected or \n", 1350 | "not. If the student is selected, then print the package. If not, then \n", 1351 | "print the string Not Selected." 1352 | ] 1353 | }, 1354 | { 1355 | "cell_type": "code", 1356 | "execution_count": 25, 1357 | "id": "74f5d307-6ee4-4896-a678-f493dda3b713", 1358 | "metadata": {}, 1359 | "outputs": [ 1360 | { 1361 | "name": "stdin", 1362 | "output_type": "stream", 1363 | "text": [ 1364 | " 8\n", 1365 | " 67\n" 1366 | ] 1367 | }, 1368 | { 1369 | "name": "stdout", 1370 | "output_type": "stream", 1371 | "text": [ 1372 | "Not Selected\n" 1373 | ] 1374 | } 1375 | ], 1376 | "source": [ 1377 | "a=float(input())\n", 1378 | "b=float(input())\n", 1379 | "if a<=5 and b>6:\n", 1380 | " print(5*b)\n", 1381 | "else:\n", 1382 | " print('Not Selected')\n" 1383 | ] 1384 | }, 1385 | { 1386 | "cell_type": "raw", 1387 | "id": "7a088e2a-3e46-4c10-8374-1251ae8340d8", 1388 | "metadata": {}, 1389 | "source": [ 1390 | "31. Accept a string as input and print PALINDROME if it is a \n", 1391 | "palindrome, and NOT PALINDROME otherwise" 1392 | ] 1393 | }, 1394 | { 1395 | "cell_type": "code", 1396 | "execution_count": 11, 1397 | "id": "cdf5b10f-0c7b-4435-b262-ecab3d17d95c", 1398 | "metadata": {}, 1399 | "outputs": [ 1400 | { 1401 | "name": "stdin", 1402 | "output_type": "stream", 1403 | "text": [ 1404 | " malayalam\n" 1405 | ] 1406 | }, 1407 | { 1408 | "name": "stdout", 1409 | "output_type": "stream", 1410 | "text": [ 1411 | "PALINDROME\n" 1412 | ] 1413 | } 1414 | ], 1415 | "source": [ 1416 | "string=input() \n", 1417 | "if(string==string[::-1]): \n", 1418 | " print(\"PALINDROME\") \n", 1419 | "else: \n", 1420 | " print(\"NOT PALINDROME\") " 1421 | ] 1422 | }, 1423 | { 1424 | "cell_type": "raw", 1425 | "id": "94aaa6f3-8957-48c7-a9fc-e120655c359a", 1426 | "metadata": {}, 1427 | "source": [ 1428 | "32. In a portal login website, you are asked to write a function get_password_strength to decide \n", 1429 | "the strength of a password. The strength is decided based on the total score of the password, Use \n", 1430 | "following conditions:\n", 1431 | "1) If password has length greater than 7 then score increases by one point.\n", 1432 | "2) If password has at least one upper case and one lower case alphabets score increases by one point.\n", 1433 | "3) If password has at least one number and no consecutive numbers like 12 or 234 then score \n", 1434 | "increases by one point.\n", 1435 | "4) If password has at least one special character (any character other than numbers and alphabets) then \n", 1436 | "score increases by one point.\n", 1437 | "5) If password contains username, then it is invalid password.\n", 1438 | "If the password has score of four points, three points, two points, or one point then print Very \n", 1439 | "Strong, Strong, Moderate, or Weak respectively. If the password is invalid, then \n", 1440 | "print PASSWORD SHOULD NOT CONTAIN USERNAME and If the score is zero, then print Use a \n", 1441 | "different password.The arguments to the function are username and password which are \n", 1442 | "already defined" 1443 | ] 1444 | }, 1445 | { 1446 | "cell_type": "code", 1447 | "execution_count": 68, 1448 | "id": "88b6f4c7-f379-4ea1-b190-2f5a3bd39e1b", 1449 | "metadata": {}, 1450 | "outputs": [], 1451 | "source": [ 1452 | "def get_password_strength(username,password):\n", 1453 | " c=0\n", 1454 | " capital='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n", 1455 | " c_flag=False\n", 1456 | " small='abcdefghijklmnopqrstuvwxyz'\n", 1457 | " s_flag=False\n", 1458 | " num='0123456789'\n", 1459 | " n_flag=False\n", 1460 | " nc_flag=True\n", 1461 | " if username in password:\n", 1462 | " print('PASSWORD SHOULD NOT CONTAIN USERNAME')\n", 1463 | " return \n", 1464 | " if len(password)>7:\n", 1465 | " c=c+1\n", 1466 | " for i in range(len(password)):\n", 1467 | " if password[i] in small:\n", 1468 | " s_flag=True\n", 1469 | " elif password[i] in capital:\n", 1470 | " c_flag=True\n", 1471 | " elif password[i] in num:\n", 1472 | " n_flag=True\n", 1473 | " if n_flag:\n", 1474 | " if i!=(len(password)-1):\n", 1475 | " if num[((num.index(password[i]))+1)]==password[i+1]:\n", 1476 | " nc_flag=False\n", 1477 | " if c_flag and s_flag :\n", 1478 | " c+=1\n", 1479 | " if n_flag and nc_flag:\n", 1480 | " c+=1\n", 1481 | " if c==4:\n", 1482 | " print('Very Strong')\n", 1483 | " return\n", 1484 | " if c==3:\n", 1485 | " print('Strong')\n", 1486 | " return\n", 1487 | " if c==2:\n", 1488 | " print('Moderate')\n", 1489 | " return\n", 1490 | " if c==1:\n", 1491 | " print('Weak')\n", 1492 | " return\n", 1493 | " if c==0:\n", 1494 | " print('Use a different password')\n", 1495 | " return" 1496 | ] 1497 | }, 1498 | { 1499 | "cell_type": "code", 1500 | "execution_count": 73, 1501 | "id": "357e4f4a-1efa-4327-b4ea-de696744d0dc", 1502 | "metadata": {}, 1503 | "outputs": [ 1504 | { 1505 | "ename": "ValueError", 1506 | "evalue": "substring not found", 1507 | "output_type": "error", 1508 | "traceback": [ 1509 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 1510 | "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", 1511 | "Cell \u001b[0;32mIn [73], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mget_password_strength\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mimran\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m1nc\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", 1512 | "Cell \u001b[0;32mIn [68], line 24\u001b[0m, in \u001b[0;36mget_password_strength\u001b[0;34m(username, password)\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m n_flag:\n\u001b[1;32m 23\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m i\u001b[38;5;241m!=\u001b[39m(\u001b[38;5;28mlen\u001b[39m(password)\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m):\n\u001b[0;32m---> 24\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m num[((\u001b[43mnum\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mindex\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpassword\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m)\u001b[38;5;241m+\u001b[39m\u001b[38;5;241m1\u001b[39m)]\u001b[38;5;241m==\u001b[39mpassword[i\u001b[38;5;241m+\u001b[39m\u001b[38;5;241m1\u001b[39m]:\n\u001b[1;32m 25\u001b[0m nc_flag\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 26\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m c_flag \u001b[38;5;129;01mand\u001b[39;00m s_flag :\n", 1513 | "\u001b[0;31mValueError\u001b[0m: substring not found" 1514 | ] 1515 | } 1516 | ], 1517 | "source": [ 1518 | "get_password_strength('imran','1nc')" 1519 | ] 1520 | }, 1521 | { 1522 | "cell_type": "raw", 1523 | "id": "270dcf73-14eb-4d68-af11-19e2b2865cca", 1524 | "metadata": {}, 1525 | "source": [ 1526 | "33.decorator that logs the date and time\n", 1527 | "#The strftime() function is used to convert date and time objects to their string representation." 1528 | ] 1529 | }, 1530 | { 1531 | "cell_type": "code", 1532 | "execution_count": 74, 1533 | "id": "f6ecf900-b332-4243-932c-b818264f9855", 1534 | "metadata": {}, 1535 | "outputs": [], 1536 | "source": [ 1537 | "from datetime import datetime\n", 1538 | "\n", 1539 | "\n", 1540 | "def log_datetime(func):\n", 1541 | " '''Log the date and time of a function'''\n", 1542 | "\n", 1543 | " def wrapper():\n", 1544 | " print(f'Function: {func.__name__}\\nRun on: {datetime.today().strftime(\"%Y-%m-%d %H:%M:%S\")}')\n", 1545 | " print(f'{\"-\"*30}')\n", 1546 | " func()\n", 1547 | " return wrapper\n", 1548 | "\n", 1549 | "\n", 1550 | "@log_datetime\n", 1551 | "def daily_backup():\n", 1552 | "\n", 1553 | " print('Daily backup job has finished.') \n", 1554 | "\n", 1555 | " \n" 1556 | ] 1557 | }, 1558 | { 1559 | "cell_type": "code", 1560 | "execution_count": 75, 1561 | "id": "d247d405-6458-4fce-8520-501fe0c4886a", 1562 | "metadata": {}, 1563 | "outputs": [ 1564 | { 1565 | "name": "stdout", 1566 | "output_type": "stream", 1567 | "text": [ 1568 | "Function: daily_backup\n", 1569 | "Run on: 2022-11-17 09:19:56\n", 1570 | "------------------------------\n", 1571 | "Daily backup job has finished.\n" 1572 | ] 1573 | } 1574 | ], 1575 | "source": [ 1576 | "daily_backup()" 1577 | ] 1578 | }, 1579 | { 1580 | "cell_type": "raw", 1581 | "id": "f755fc11-c84c-4110-8611-0b246aed2047", 1582 | "metadata": {}, 1583 | "source": [ 1584 | "34.Program to Get Data Items From a List Appearing Odd Number of Times" 1585 | ] 1586 | }, 1587 | { 1588 | "cell_type": "code", 1589 | "execution_count": 76, 1590 | "id": "b750fdf0-a2d6-46fa-8da8-302f9d2567fd", 1591 | "metadata": {}, 1592 | "outputs": [ 1593 | { 1594 | "name": "stdout", 1595 | "output_type": "stream", 1596 | "text": [ 1597 | "[2, 3, 5]\n" 1598 | ] 1599 | } 1600 | ], 1601 | "source": [ 1602 | "x = [1,2,3,4,5,1,3,3,4]\n", 1603 | "l1 = []\n", 1604 | "for i in x:\n", 1605 | " if x.count(i) % 2 != 0:\n", 1606 | " if i not in l1:\n", 1607 | " l1.append(i)\n", 1608 | "print(l1)" 1609 | ] 1610 | } 1611 | ], 1612 | "metadata": { 1613 | "kernelspec": { 1614 | "display_name": "Python 3 (ipykernel)", 1615 | "language": "python", 1616 | "name": "python3" 1617 | }, 1618 | "language_info": { 1619 | "codemirror_mode": { 1620 | "name": "ipython", 1621 | "version": 3 1622 | }, 1623 | "file_extension": ".py", 1624 | "mimetype": "text/x-python", 1625 | "name": "python", 1626 | "nbconvert_exporter": "python", 1627 | "pygments_lexer": "ipython3", 1628 | "version": "3.10.6" 1629 | } 1630 | }, 1631 | "nbformat": 4, 1632 | "nbformat_minor": 5 1633 | } 1634 | -------------------------------------------------------------------------------- /Python Decorators.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "23135042-f4f6-49e1-8210-71922ecfd5c5", 6 | "metadata": {}, 7 | "source": [ 8 | "## Function" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": null, 14 | "id": "ae87f412-8579-443a-982a-9faca4f10455", 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "def function_name(parameters):\n", 19 | "\t\"\"\"docstring\"\"\"\n", 20 | "\tstatement(s)" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": null, 26 | "id": "1e14580c-bb4f-4421-99f4-bb5343dcfc63", 27 | "metadata": {}, 28 | "outputs": [], 29 | "source": [ 30 | "Example of a function" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": 3, 36 | "id": "be831ad7-2d08-4098-a861-22a82a78dbdc", 37 | "metadata": {}, 38 | "outputs": [], 39 | "source": [ 40 | "def test(name):\n", 41 | " \"\"\"\n", 42 | " This function greets to\n", 43 | " the person passed in as\n", 44 | " a parameter\n", 45 | " \"\"\"\n", 46 | " print(\"Hello, \" + name + \". Good morning!\")" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 5, 52 | "id": "5e81ad36-3bcb-4c2d-931c-3a9bebc734d5", 53 | "metadata": {}, 54 | "outputs": [ 55 | { 56 | "name": "stdout", 57 | "output_type": "stream", 58 | "text": [ 59 | "Hello, imran. Good morning!\n" 60 | ] 61 | } 62 | ], 63 | "source": [ 64 | "test('imran')" 65 | ] 66 | }, 67 | { 68 | "cell_type": "markdown", 69 | "id": "45d129ca-0aad-4a8e-ba4f-a6aceac5098c", 70 | "metadata": {}, 71 | "source": [ 72 | "## The return statement" 73 | ] 74 | }, 75 | { 76 | "cell_type": "raw", 77 | "id": "d707d3d1-7dbe-4a35-8481-98e586892a45", 78 | "metadata": {}, 79 | "source": [ 80 | "The return statement is used to exit a function and go back to the place from where it was called." 81 | ] 82 | }, 83 | { 84 | "cell_type": "raw", 85 | "id": "5df50995-9971-4184-b6af-82738c5d8c83", 86 | "metadata": {}, 87 | "source": [ 88 | "Syntax of return\n", 89 | "return [expression_list]" 90 | ] 91 | }, 92 | { 93 | "cell_type": "raw", 94 | "id": "7ad41b97-e643-4186-adc0-92c8364c1423", 95 | "metadata": {}, 96 | "source": [ 97 | "This statement can contain an expression that gets evaluated and the value is returned. If there is no expression in \n", 98 | "the statement or the return statement itself is not present inside a function, then the function will return the None object." 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": 6, 104 | "id": "0556514b-6b16-4c74-8f86-c370aadd0ac7", 105 | "metadata": {}, 106 | "outputs": [ 107 | { 108 | "name": "stdout", 109 | "output_type": "stream", 110 | "text": [ 111 | "Hello, Ineuron. Good morning!\n" 112 | ] 113 | } 114 | ], 115 | "source": [ 116 | "test(\"Ineuron\")" 117 | ] 118 | }, 119 | { 120 | "cell_type": "code", 121 | "execution_count": 7, 122 | "id": "c4c7ad4c-7222-44c6-9025-e377d8fb1385", 123 | "metadata": {}, 124 | "outputs": [ 125 | { 126 | "name": "stdout", 127 | "output_type": "stream", 128 | "text": [ 129 | "Hello, Ineuron. Good morning!\n", 130 | "None\n" 131 | ] 132 | } 133 | ], 134 | "source": [ 135 | " print(test(\"Ineuron\"))" 136 | ] 137 | }, 138 | { 139 | "cell_type": "raw", 140 | "id": "12995a5f-c452-43ed-a13b-279369ad219f", 141 | "metadata": {}, 142 | "source": [ 143 | "Here, None is the returned value since greet() directly prints the name and no return statement is used." 144 | ] 145 | }, 146 | { 147 | "cell_type": "raw", 148 | "id": "37baa17b-9fd8-4930-a493-2f3103e56079", 149 | "metadata": {}, 150 | "source": [ 151 | "Example of return" 152 | ] 153 | }, 154 | { 155 | "cell_type": "code", 156 | "execution_count": 8, 157 | "id": "b271fb46-71e5-40fc-b501-6d6d9676dace", 158 | "metadata": {}, 159 | "outputs": [ 160 | { 161 | "name": "stdout", 162 | "output_type": "stream", 163 | "text": [ 164 | "2\n", 165 | "4\n" 166 | ] 167 | } 168 | ], 169 | "source": [ 170 | "def absolute_value(num):\n", 171 | " \"\"\"This function returns the absolute\n", 172 | " value of the entered number\"\"\"\n", 173 | "\n", 174 | " if num >= 0:\n", 175 | " return num\n", 176 | " else:\n", 177 | " return -num\n", 178 | "\n", 179 | "\n", 180 | "print(absolute_value(2))\n", 181 | "\n", 182 | "print(absolute_value(-4))" 183 | ] 184 | }, 185 | { 186 | "cell_type": "markdown", 187 | "id": "5949a920-bfc4-4771-94f3-996083d37092", 188 | "metadata": {}, 189 | "source": [ 190 | "## Python Decorators" 191 | ] 192 | }, 193 | { 194 | "cell_type": "code", 195 | "execution_count": 9, 196 | "id": "6579d84a-0d5e-4e39-b12e-0ad5f63dbaa3", 197 | "metadata": {}, 198 | "outputs": [], 199 | "source": [ 200 | "def square(x):\n", 201 | " return x * x" 202 | ] 203 | }, 204 | { 205 | "cell_type": "code", 206 | "execution_count": 10, 207 | "id": "7b71e181-77f3-42b6-aff6-a38817c115dc", 208 | "metadata": {}, 209 | "outputs": [], 210 | "source": [ 211 | "f=square(5)" 212 | ] 213 | }, 214 | { 215 | "cell_type": "code", 216 | "execution_count": 11, 217 | "id": "3285daca-6d5b-46f9-861d-38a129c9b041", 218 | "metadata": {}, 219 | "outputs": [ 220 | { 221 | "data": { 222 | "text/plain": [ 223 | "25" 224 | ] 225 | }, 226 | "execution_count": 11, 227 | "metadata": {}, 228 | "output_type": "execute_result" 229 | } 230 | ], 231 | "source": [ 232 | "f" 233 | ] 234 | }, 235 | { 236 | "cell_type": "code", 237 | "execution_count": 12, 238 | "id": "eddbd37d-0e2e-4f74-92ac-f9415e9c7cf9", 239 | "metadata": {}, 240 | "outputs": [ 241 | { 242 | "data": { 243 | "text/plain": [ 244 | "int" 245 | ] 246 | }, 247 | "execution_count": 12, 248 | "metadata": {}, 249 | "output_type": "execute_result" 250 | } 251 | ], 252 | "source": [ 253 | "type(f)" 254 | ] 255 | }, 256 | { 257 | "cell_type": "code", 258 | "execution_count": 13, 259 | "id": "075e4672-ebad-492f-9e5c-69c42bd6e1fb", 260 | "metadata": {}, 261 | "outputs": [ 262 | { 263 | "name": "stdout", 264 | "output_type": "stream", 265 | "text": [ 266 | "\n", 267 | "25\n" 268 | ] 269 | } 270 | ], 271 | "source": [ 272 | "print(square)\n", 273 | "print(f)" 274 | ] 275 | }, 276 | { 277 | "cell_type": "code", 278 | "execution_count": 14, 279 | "id": "7dd5951b-b0ca-47e6-89e8-250e83d0f53b", 280 | "metadata": {}, 281 | "outputs": [], 282 | "source": [ 283 | "f=square" 284 | ] 285 | }, 286 | { 287 | "cell_type": "code", 288 | "execution_count": 15, 289 | "id": "58c9f915-256a-484a-af41-1d48dda9a1b9", 290 | "metadata": {}, 291 | "outputs": [ 292 | { 293 | "name": "stdout", 294 | "output_type": "stream", 295 | "text": [ 296 | "\n", 297 | "\n" 298 | ] 299 | } 300 | ], 301 | "source": [ 302 | "print(square)\n", 303 | "print(f)" 304 | ] 305 | }, 306 | { 307 | "cell_type": "code", 308 | "execution_count": 16, 309 | "id": "2be2c87f-dcb0-433d-91ca-e23841bbe88e", 310 | "metadata": {}, 311 | "outputs": [ 312 | { 313 | "data": { 314 | "text/plain": [ 315 | "25" 316 | ] 317 | }, 318 | "execution_count": 16, 319 | "metadata": {}, 320 | "output_type": "execute_result" 321 | } 322 | ], 323 | "source": [ 324 | "f(5)" 325 | ] 326 | }, 327 | { 328 | "cell_type": "code", 329 | "execution_count": 17, 330 | "id": "1ec68f8a-980f-49ef-bc51-e0bfb23c0a94", 331 | "metadata": {}, 332 | "outputs": [ 333 | { 334 | "data": { 335 | "text/plain": [ 336 | "function" 337 | ] 338 | }, 339 | "execution_count": 17, 340 | "metadata": {}, 341 | "output_type": "execute_result" 342 | } 343 | ], 344 | "source": [ 345 | "type(f)" 346 | ] 347 | }, 348 | { 349 | "cell_type": "code", 350 | "execution_count": 18, 351 | "id": "e593ef27-7216-4ab0-9472-b52791a9636d", 352 | "metadata": {}, 353 | "outputs": [ 354 | { 355 | "name": "stdout", 356 | "output_type": "stream", 357 | "text": [ 358 | "\n", 359 | "25\n" 360 | ] 361 | } 362 | ], 363 | "source": [ 364 | "print(square)\n", 365 | "print(f(5))" 366 | ] 367 | }, 368 | { 369 | "cell_type": "raw", 370 | "id": "c497c3dc-32c3-4393-b60a-bd84bd92ad59", 371 | "metadata": {}, 372 | "source": [ 373 | "--------------------------------------------------------------------------------" 374 | ] 375 | }, 376 | { 377 | "cell_type": "code", 378 | "execution_count": 19, 379 | "id": "45774d61-756e-4eb4-8dc9-34e36827811b", 380 | "metadata": {}, 381 | "outputs": [], 382 | "source": [ 383 | "def outer_func():\n", 384 | " message=\"Hi\"\n", 385 | " \n", 386 | " def inner_func():\n", 387 | " print(message)\n", 388 | " return inner_func()\n", 389 | "#exceuting innter function and returning\n", 390 | "#inner_func() is executing\n", 391 | "#return a function without executing it inner_func after these we need to assign a vvaribale" 392 | ] 393 | }, 394 | { 395 | "cell_type": "code", 396 | "execution_count": 20, 397 | "id": "9aa6cb4c-46a9-49fa-9576-7235b8646698", 398 | "metadata": {}, 399 | "outputs": [ 400 | { 401 | "name": "stdout", 402 | "output_type": "stream", 403 | "text": [ 404 | "Hi\n" 405 | ] 406 | } 407 | ], 408 | "source": [ 409 | "outer_func()" 410 | ] 411 | }, 412 | { 413 | "cell_type": "code", 414 | "execution_count": 21, 415 | "id": "b7387ee3-9dd1-4c48-bc6e-d87d5e010637", 416 | "metadata": {}, 417 | "outputs": [], 418 | "source": [ 419 | "def outer_func():\n", 420 | " message=\"Hi\"\n", 421 | " \n", 422 | " def inner_func():\n", 423 | " print(message)\n", 424 | " return inner_func" 425 | ] 426 | }, 427 | { 428 | "cell_type": "code", 429 | "execution_count": 22, 430 | "id": "7ba2e75d-3388-4cac-8007-7d26d00b8dc4", 431 | "metadata": {}, 432 | "outputs": [], 433 | "source": [ 434 | "my_func =outer_func()" 435 | ] 436 | }, 437 | { 438 | "cell_type": "code", 439 | "execution_count": 23, 440 | "id": "62a46417-c58c-4a72-97a1-b8cc8689d58f", 441 | "metadata": {}, 442 | "outputs": [ 443 | { 444 | "data": { 445 | "text/plain": [ 446 | "function" 447 | ] 448 | }, 449 | "execution_count": 23, 450 | "metadata": {}, 451 | "output_type": "execute_result" 452 | } 453 | ], 454 | "source": [ 455 | "type(my_func)" 456 | ] 457 | }, 458 | { 459 | "cell_type": "code", 460 | "execution_count": 24, 461 | "id": "5df469e4-b4d0-43f4-8678-aa8b4ab96dae", 462 | "metadata": {}, 463 | "outputs": [ 464 | { 465 | "name": "stdout", 466 | "output_type": "stream", 467 | "text": [ 468 | ".inner_func at 0x7fb84c749ea0>\n" 469 | ] 470 | } 471 | ], 472 | "source": [ 473 | "print(my_func)" 474 | ] 475 | }, 476 | { 477 | "cell_type": "code", 478 | "execution_count": 25, 479 | "id": "9c1e5171-9270-413f-9d01-b068d49a86af", 480 | "metadata": {}, 481 | "outputs": [ 482 | { 483 | "name": "stdout", 484 | "output_type": "stream", 485 | "text": [ 486 | "Hi\n" 487 | ] 488 | } 489 | ], 490 | "source": [ 491 | "my_func()" 492 | ] 493 | }, 494 | { 495 | "cell_type": "raw", 496 | "id": "a0381653-6058-4853-b615-10d7cbfa7b72", 497 | "metadata": {}, 498 | "source": [ 499 | "A decorator is a design pattern in Python that allows a user to add new functionality \n", 500 | "to an existing object without modifying its structure." 501 | ] 502 | }, 503 | { 504 | "cell_type": "code", 505 | "execution_count": 26, 506 | "id": "797660ae-948c-4e5a-a264-5d5cbe882aa0", 507 | "metadata": {}, 508 | "outputs": [], 509 | "source": [ 510 | "def printer():\n", 511 | " print(\"hello world!\")" 512 | ] 513 | }, 514 | { 515 | "cell_type": "code", 516 | "execution_count": 27, 517 | "id": "c90ae6df-f40b-4e3a-a1c0-c089c0b1f7d5", 518 | "metadata": {}, 519 | "outputs": [], 520 | "source": [ 521 | "def display_info(func):\n", 522 | " def inner():\n", 523 | " print(\"Executing\",func.__name__,\"function\")\n", 524 | " func()\n", 525 | " print(\"finished exceution\")\n", 526 | " return inner" 527 | ] 528 | }, 529 | { 530 | "cell_type": "code", 531 | "execution_count": 28, 532 | "id": "5c9dc7ba-dacc-435e-a2d2-acc9424ffaf9", 533 | "metadata": {}, 534 | "outputs": [ 535 | { 536 | "name": "stdout", 537 | "output_type": "stream", 538 | "text": [ 539 | "Executing printer function\n", 540 | "hello world!\n", 541 | "finished exceution\n" 542 | ] 543 | } 544 | ], 545 | "source": [ 546 | "decorated_func=display_info(printer)\n", 547 | "decorated_func()" 548 | ] 549 | }, 550 | { 551 | "cell_type": "raw", 552 | "id": "0186766e-15c6-45c7-aff0-3f8caf0b332c", 553 | "metadata": {}, 554 | "source": [ 555 | "********************************************************************\n", 556 | "Above code can be written in other form\n", 557 | "********************************************************************" 558 | ] 559 | }, 560 | { 561 | "cell_type": "code", 562 | "execution_count": 33, 563 | "id": "130aff44-fa60-447c-9e3f-612195247080", 564 | "metadata": {}, 565 | "outputs": [], 566 | "source": [ 567 | "def display_info(func):\n", 568 | " def inner():\n", 569 | " print(\"Executing\",func.__name__,\"function\")\n", 570 | " func()\n", 571 | " print(\"finished exceution\")\n", 572 | " return inner" 573 | ] 574 | }, 575 | { 576 | "cell_type": "code", 577 | "execution_count": 34, 578 | "id": "41fd249f-be7d-4fd8-b38c-d158bd73b022", 579 | "metadata": {}, 580 | "outputs": [], 581 | "source": [ 582 | "@display_info\n", 583 | "def printer():\n", 584 | " print(\"hello world!\")" 585 | ] 586 | }, 587 | { 588 | "cell_type": "code", 589 | "execution_count": 35, 590 | "id": "7fef16ad-4698-40bf-ba1b-db82c67a538b", 591 | "metadata": {}, 592 | "outputs": [ 593 | { 594 | "name": "stdout", 595 | "output_type": "stream", 596 | "text": [ 597 | "Executing printer function\n", 598 | "hello world!\n", 599 | "finished exceution\n" 600 | ] 601 | } 602 | ], 603 | "source": [ 604 | "printer()" 605 | ] 606 | }, 607 | { 608 | "cell_type": "raw", 609 | "id": "43168a1d-e9a4-4a2b-bcbd-cb65c14c83c2", 610 | "metadata": {}, 611 | "source": [ 612 | "---------------------------------------------------------------------------------------------------" 613 | ] 614 | }, 615 | { 616 | "cell_type": "code", 617 | "execution_count": 36, 618 | "id": "ce00d29c-832b-441b-bc60-673c58b90233", 619 | "metadata": {}, 620 | "outputs": [], 621 | "source": [ 622 | "def divide(a, b):\n", 623 | " return a/b" 624 | ] 625 | }, 626 | { 627 | "cell_type": "code", 628 | "execution_count": 37, 629 | "id": "ddf173a3-9e58-496c-9494-7ce27e91adf1", 630 | "metadata": {}, 631 | "outputs": [ 632 | { 633 | "data": { 634 | "text/plain": [ 635 | "0.4" 636 | ] 637 | }, 638 | "execution_count": 37, 639 | "metadata": {}, 640 | "output_type": "execute_result" 641 | } 642 | ], 643 | "source": [ 644 | "divide(2,5)" 645 | ] 646 | }, 647 | { 648 | "cell_type": "code", 649 | "execution_count": 38, 650 | "id": "a277e48f-f12a-4f38-b1c6-d1ce46f8b2cb", 651 | "metadata": {}, 652 | "outputs": [ 653 | { 654 | "ename": "ZeroDivisionError", 655 | "evalue": "division by zero", 656 | "output_type": "error", 657 | "traceback": [ 658 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 659 | "\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", 660 | "Cell \u001b[0;32mIn [38], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mdivide\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m2\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m)\u001b[49m\n", 661 | "Cell \u001b[0;32mIn [36], line 2\u001b[0m, in \u001b[0;36mdivide\u001b[0;34m(a, b)\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdivide\u001b[39m(a, b):\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43ma\u001b[49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[43mb\u001b[49m\n", 662 | "\u001b[0;31mZeroDivisionError\u001b[0m: division by zero" 663 | ] 664 | } 665 | ], 666 | "source": [ 667 | "divide(2,0)" 668 | ] 669 | }, 670 | { 671 | "cell_type": "code", 672 | "execution_count": 39, 673 | "id": "3aac4298-5c35-45a6-9093-6bf0f51be542", 674 | "metadata": {}, 675 | "outputs": [], 676 | "source": [ 677 | "def smart_divide(func):\n", 678 | " def inner(a, b):\n", 679 | " print(\"I am going to divide\", a, \"and\", b)\n", 680 | " if b == 0:\n", 681 | " print(\"Whoops! cannot divide\")\n", 682 | " return\n", 683 | "\n", 684 | " return func(a, b)\n", 685 | " return inner" 686 | ] 687 | }, 688 | { 689 | "cell_type": "code", 690 | "execution_count": 40, 691 | "id": "8635d012-d646-450d-baf8-31c49edeacd5", 692 | "metadata": {}, 693 | "outputs": [], 694 | "source": [ 695 | "def inner(a, b):\n", 696 | " print(\"I am going to divide\", a, \"and\", b)\n", 697 | " if b == 0:\n", 698 | " print(\"Whoops! cannot divide\")\n", 699 | " return" 700 | ] 701 | }, 702 | { 703 | "cell_type": "code", 704 | "execution_count": 42, 705 | "id": "88cfaf4a-0c53-481e-a4d8-13cbe0550998", 706 | "metadata": {}, 707 | "outputs": [ 708 | { 709 | "name": "stdout", 710 | "output_type": "stream", 711 | "text": [ 712 | "I am going to divide 4 and 2\n", 713 | "None\n" 714 | ] 715 | } 716 | ], 717 | "source": [ 718 | "print(inner(4,2))" 719 | ] 720 | }, 721 | { 722 | "cell_type": "code", 723 | "execution_count": 43, 724 | "id": "8344cfd6-9c03-4783-9c70-ed3d4a4200b1", 725 | "metadata": {}, 726 | "outputs": [], 727 | "source": [ 728 | "def smart_divide(func):\n", 729 | " def inner(a, b):\n", 730 | " print(\"I am going to divide\", a, \"and\", b)\n", 731 | " if b == 0:\n", 732 | " print(\"Whoops! cannot divide\")\n", 733 | " return\n", 734 | "\n", 735 | " return func(a, b)\n", 736 | " return inner" 737 | ] 738 | }, 739 | { 740 | "cell_type": "code", 741 | "execution_count": 44, 742 | "id": "689ae819-d86c-4058-8da4-151d821312f6", 743 | "metadata": {}, 744 | "outputs": [], 745 | "source": [ 746 | "@smart_divide\n", 747 | "def divide(a, b):\n", 748 | " print(a/b)" 749 | ] 750 | }, 751 | { 752 | "cell_type": "code", 753 | "execution_count": 45, 754 | "id": "28d4bd27-e05f-457f-85a6-b00d4ddb3660", 755 | "metadata": {}, 756 | "outputs": [ 757 | { 758 | "name": "stdout", 759 | "output_type": "stream", 760 | "text": [ 761 | "I am going to divide 2 and 5\n", 762 | "0.4\n" 763 | ] 764 | } 765 | ], 766 | "source": [ 767 | "divide(2,5)" 768 | ] 769 | }, 770 | { 771 | "cell_type": "code", 772 | "execution_count": 46, 773 | "id": "616aea8d-5c5e-4523-a398-064673c5768f", 774 | "metadata": {}, 775 | "outputs": [ 776 | { 777 | "name": "stdout", 778 | "output_type": "stream", 779 | "text": [ 780 | "I am going to divide 2 and 0\n", 781 | "Whoops! cannot divide\n" 782 | ] 783 | } 784 | ], 785 | "source": [ 786 | "divide(2,0)\n", 787 | " " 788 | ] 789 | }, 790 | { 791 | "cell_type": "markdown", 792 | "id": "d7f47758-9f88-4de9-8224-cafe662c03a5", 793 | "metadata": {}, 794 | "source": [ 795 | "## Chaining Decorators in Python" 796 | ] 797 | }, 798 | { 799 | "cell_type": "raw", 800 | "id": "a216bfb2-4a14-4643-87d9-c3226b48713b", 801 | "metadata": {}, 802 | "source": [ 803 | "This is to say, a function can be decorated multiple times with different (or same) decorators. We simply \n", 804 | "place the decorators above the desired function.\n", 805 | "\n" 806 | ] 807 | }, 808 | { 809 | "cell_type": "code", 810 | "execution_count": 48, 811 | "id": "fdd57aab-406b-4812-a4e1-dcb214f543ac", 812 | "metadata": {}, 813 | "outputs": [ 814 | { 815 | "name": "stdout", 816 | "output_type": "stream", 817 | "text": [ 818 | "******************************\n", 819 | "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n", 820 | "Hello\n", 821 | "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n", 822 | "******************************\n" 823 | ] 824 | } 825 | ], 826 | "source": [ 827 | "def star(func):\n", 828 | " def inner(*args, **kwargs):\n", 829 | " print(\"*\" * 30)\n", 830 | " func(*args, **kwargs)\n", 831 | " print(\"*\" * 30)\n", 832 | " return inner\n", 833 | "\n", 834 | "\n", 835 | "def percent(func):\n", 836 | " def inner(*args, **kwargs):\n", 837 | " print(\"%\" * 30)\n", 838 | " func(*args, **kwargs)\n", 839 | " print(\"%\" * 30)\n", 840 | " return inner\n", 841 | "\n", 842 | "\n", 843 | "@star\n", 844 | "@percent\n", 845 | "def printer(msg):\n", 846 | " print(msg)\n", 847 | "\n", 848 | "\n", 849 | "printer(\"Hello\")" 850 | ] 851 | }, 852 | { 853 | "attachments": { 854 | "f5995941-a8b0-41f4-ae52-a500ab6274a3.png": { 855 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAA+kAAAGhCAYAAAAdqfVXAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAFrLSURBVHhe7d0LeBR1gu/9H0KISYAYSIBIEhAdbhFQQCMKIyNZxWFlRkaYd1AXWWUOyxxgVx3Hdx3W47qenZmj7kH38HAGXeUdhn1GZmEGxxVdQBAUM1zkFi4RArkgl3ANkNhc3/+/urrT6XTnRtJU4Pt5LLqqurqquqp9nvzqf2vlO3v+kgAAAAAAwBV3nfsKAAAAAACuMEI6AAAAAAAeQUgHAAAAAMAjCOkAAAAAAHgEIR0AAAAAAI8gpAMAAAAA4BGEdAAAAAAAPIKQDgAAAACARxDSAQAAAADwCEI6AAAAAAAeQUgHAAAAAMAjCOkAAAAAAHgEIR0AAAAAAI8gpAMAAAAA4BGEdAAAAAAAPIKQDgAAAACARxDSAQAAAADwCEI6AAAAAAAeQUgHAAAAAMAjCOkAAAAAAHiEt0O6z6fK0z6du+gutxQt9bzhbRcv6GjxPhXsLNHBExfclQAAAACuJq18Z89fcuebTeXX+1RS7i7UR4fO6nVjovb+YZZeXSaN/LsZGnuz+14L0FLPG951bs9Kv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AQAAAABAbQjpAAAAAAB4BCEdAAAAAACPIKQDAAAAAOARhHQAAAAAADyCkA4AAAAAgEcQ0gEAAAAA8ATp/weFEcCTa9EncwAAAABJRU5ErkJggg==" 856 | } 857 | }, 858 | "cell_type": "markdown", 859 | "id": "b8ec37c1-4939-4201-93dd-bb1410e78a51", 860 | "metadata": {}, 861 | "source": [ 862 | "![image.png](attachment:f5995941-a8b0-41f4-ae52-a500ab6274a3.png)" 863 | ] 864 | }, 865 | { 866 | "cell_type": "raw", 867 | "id": "e91020a4-378d-432c-afe5-49665ba5314a", 868 | "metadata": {}, 869 | "source": [ 870 | "The order in which we chain decorators matter. If we had reversed the order as," 871 | ] 872 | }, 873 | { 874 | "cell_type": "code", 875 | "execution_count": 51, 876 | "id": "6a8603f5-dd0b-4b67-a131-5f7821a0f4bd", 877 | "metadata": {}, 878 | "outputs": [ 879 | { 880 | "name": "stdout", 881 | "output_type": "stream", 882 | "text": [ 883 | "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n", 884 | "******************************\n", 885 | "Hello\n", 886 | "******************************\n", 887 | "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n" 888 | ] 889 | } 890 | ], 891 | "source": [ 892 | "def star(func):\n", 893 | " def inner(*args, **kwargs):\n", 894 | " print(\"*\" * 30)\n", 895 | " func(*args, **kwargs)\n", 896 | " print(\"*\" * 30)\n", 897 | " return inner\n", 898 | "\n", 899 | "\n", 900 | "def percent(func):\n", 901 | " def inner(*args, **kwargs):\n", 902 | " print(\"%\" * 30)\n", 903 | " func(*args, **kwargs)\n", 904 | " print(\"%\" * 30)\n", 905 | " return inner\n", 906 | "\n", 907 | "\n", 908 | "\n", 909 | "@percent\n", 910 | "@star\n", 911 | "def printer(msg):\n", 912 | " print(msg)\n", 913 | " \n", 914 | "printer(\"Hello\")" 915 | ] 916 | }, 917 | { 918 | "cell_type": "code", 919 | "execution_count": null, 920 | "id": "12bac8f8-09c9-458d-8c8d-74fbc6e07876", 921 | "metadata": {}, 922 | "outputs": [], 923 | "source": [] 924 | }, 925 | { 926 | "cell_type": "code", 927 | "execution_count": null, 928 | "id": "d51c48dd-ca59-44dd-aa1f-29678289a481", 929 | "metadata": {}, 930 | "outputs": [], 931 | "source": [] 932 | }, 933 | { 934 | "cell_type": "code", 935 | "execution_count": null, 936 | "id": "4b489dc0-62a7-45fa-ad9d-8a5dc84e2c02", 937 | "metadata": {}, 938 | "outputs": [], 939 | "source": [] 940 | } 941 | ], 942 | "metadata": { 943 | "kernelspec": { 944 | "display_name": "Python 3 (ipykernel)", 945 | "language": "python", 946 | "name": "python3" 947 | }, 948 | "language_info": { 949 | "codemirror_mode": { 950 | "name": "ipython", 951 | "version": 3 952 | }, 953 | "file_extension": ".py", 954 | "mimetype": "text/x-python", 955 | "name": "python", 956 | "nbconvert_exporter": "python", 957 | "pygments_lexer": "ipython3", 958 | "version": "3.10.6" 959 | } 960 | }, 961 | "nbformat": 4, 962 | "nbformat_minor": 5 963 | } 964 | --------------------------------------------------------------------------------