Partial preview of the text
Download Study Material with ease and more Study notes Programming Paradigms in PDF only on Docsity!
z0) apters ‘Page No. Tnttoduction to. Python | 44 What is ere ~ {4% Felines. a! es {13 Applications oF python 4 ies eae — (15 Fits python Program -_|Modules, Comment and Pip 21 Modules in python — R4 Chmmmenls. in. python 18:3 What is a ppt + | Variables Data Tpes keywords 2 Operators ‘|8-1 Variables in python 8-44 Tdentifier in puthon 132 ri on in python 184 Operas pon | \Lish, Diclonary, set, Tiple } Tipe. Conversion a |42 Dickonary M3 set ald, (i Jo- 20 2\- 25 SRNO. | 15) ee ae vies aes | 5. | Flow Crtrol goed 5-1 Tf- statement on | 52 Th-else_ statement a | 53 elif _clakment Mine | 5:4 Nested if slatement | i. | 7 : ca nr or hil ep ee, Sot @:2 For loop = 6-3 For ope ng_rngel Fanchn a 6-4 Nested for_loop_ —a a — |} |. Stet . hia | 4a-46 pe on ‘i — sien _ i 7a. Healing Shing_in. phon 2 ee 13. Ge. ’ neg and e a __ S| i___ | 7-4 Deleting the string ee ee 2 15. Sting ‘formatting ae D sz a = 'S1-No |_ 12. 15: ‘\r- chaptens Advanced data shucures IRL Lists 2 sels 2:3 Dictionaries R4 stacks and queues (Using Lists) Funckional Proqrammin 3-1 Map, Filler and Yeduce 82 Lambda and Anonymous functions Working with files and directories 4-1 File Yo Operations (Binary Files) l4-2 Directory Manipulation 43 Working with Osv and JSON Files Requlay Expressions IBV Introduction to requldy Expression 15-2 Pattern matching with re’ module 15-3 Cmmon regudr Expression Patterns Web development with python 6-1 Introductian to web development 16-2 Building simple web Applications with Flask and Django Data Analysis and Visualization 17-1 NumPy and Pandas for Data manipulation IT2 Matp otlib and seaborn - Page Ne 62- & 6928 TA-81 82-84 85-91 92-Jol | olasnmate | Bate .) | hy -- C) | i cs No chapter Page No: : _ 1 {Machine learning and Al item | 8:1 Intoduchion 40 machine leaning | 188 Using libraries like scikit - lean | 02-10 | dnd TensorFlow sascanginatessilllabcitiaatiian va Ig Simple, Machine. learning example. han. | classmate Large «slandard Library : Puthan provides avast @landard jibratry with readu—4a-use mere and Functions for various tasks J Saving developers time and effort in implementing cammon_ functionalities. } Object — Oriented Progranmnin (oop) := = Fythan supports the abject ~ Oriente pingramining paradiqm allowing for the creatian SS) dnd manipulatian af objects Classes and inheritance: e [Goss-Platform ae - Pubhan is available on multi U platforms , including” Windams ,macQsS and Linux, making I highly pattable ana versatile . an Third = Party Libraries ‘- Puthan has a vast eco: orale of third- party libraries ond Sramewarks thal expand capabi lies ‘ir in different domains, such as web development | data dnalisis , and machine. merce J J \Tnterpreted Nature ‘= Pythan is an interpreted language meaning it_ does not require compilalin The relies tees clevelopment cule peeteenee exeruled directly without tiger oacleeree seprate compiloshion step: Thteqradion i Pulhon can easily intearote. with — J other lanauages like C, CH dnd Java allowing developers | to leverage existing codebases and libraries: UG | I 4:8 Applications OF Python Python is widely used in_\yoxiau.s domains Beat. numerous apslicatians due dauike Flexibility | Copy righted by QdehithCurious . coz, ~ - eccasgiiialeae || Gdse oF use. Were are some key dreas where p oi dinds Opplicabion : 7 Web development !- Python is extensively used in web devela- T pment Ftamewatks stich as Django and Flask “These framewo- tks provides ePRicient tools Bite theisian to build elynamic. weksites and nal aprlicalions Data Analusis .an Visualization :- Puthan's rich ecosystem af libraries including NumPy Pandas. and Matplatlih , make it Q popular choice far data analysis and visualization endbles professionals to pocess tanipulale and visualize. cata _efterlively: i J Machine learning and AriPicial Inlelhiaence i Putbon has beco-_ a) , 7 me the do-te language, for_ machine leamina and Al Piniecks. libraries tik Ténsarflow keras and scikit -learn provide. pawer- ful +tools for implementing complex alanrithms and -frsining t =! J madels - Automation and Scripbing : Python’ easy-to-read guntax Fe ‘ and rapid development Sucle make it an ideal choice far aulamalion eens sect ul! is commonly used for tasks such as file manipulation, data parsing a system admi “al tation: Ly Pathon Installation 75 download and install Puthan follow sthese steps Copyt iahted by CodeWlithCurious Com classmate. a) id = 3 Printing Hella Wwarld ising python Print ("Hello World |") let's break down the cade‘ +The print() Function is used to display the. specific massage ot value an the cansale- * Th this case, we pass the. ching "I "Hello, World |" an argument rem print) function The sting Is ised in dale au ates! ae Goitat Meee a cane in _Puthon - Comments ore janored by the interoreter and are used to provide explainakians ot nates ‘la the mde. ae —~ i Copyrighted by (odelith Curious ‘Con booees pa % ain ° { our? Modtles- 1 —— = —fomment- Pre BEI ED Modules in pathon # [i Modules provide a way to oranice. “your code. logically, “instead of having: all upu ~oode in_a_cingle Sle sag split it ints mutliplemodules based on eir_purnase - pe when uow want th use the Funchionality fray 4 mo 1 won coo import it into gour current program at_anather ‘Module. = | This allows you to access and _use funclions classes — and variables defined hithin hak madule you fim cred waiting dhe same. code repeatedly and instead’ reuse the. cade — debinad in the module- ! “Three_main types of modules: - = | Modules he I fee | Built-in madules External Modules |__| u ¥ ss ) Built =-in modules : These are _madules - instal Be with python . They are — ibang and i Copy right CodeWith(c | chaste Date : . Tn than, comments.crelenoled_by-ahe- hash. opmbal(i) followed by the comment text. When the Pullin inte - prea eroun lets a comment, it ignores it and maves to the next linas of code. Comments can he. placed ot the end_of line or! an_a_line by themeel ves: Ths iemporlank 40 that comments ar are meant tar human | readers and_ar not executed by the Python inkrpreten- Piheketieucth eu! bavi toudmprict ior the pragramn's a Punchionality ~or_performante = = a Tfpesof Oomments.' T[Wpes af Comments t a. Single=line Comment Mull: -line Comment 1 Single -line comments Gingle-line. comments are used to add explainatary nol8s or comments on a single. line of colle. They “lar! with a bach sumbol (+)-and continue until the end of the line. Anything. written afler the hash sSyonbel is considera a commen? and is ignored by the python jnternreter « Here's an Skanhph : AE This is a single—line comment | 4 ~=5 Ht Assigning a value to the variahb x | \ (pyrighted by GdeWithCrricus Cm | 7.4 cassoute ) = Q- Multi-line. Comments : fj Mulli-line comments also known as_block cam- [= ments, allow ou +0 add comments that sor multiple : = lines - Python ae not have a built~ in syntax speci! | Fically for _mull'= line comments, but you can a heive. a 4his bu using triple quotes Ceither single. or cloub dn create a Bring thale is not assianed to any ~_— Variable - Since it is not used elsethere._in the? ade, it acts asa comment - | Here's an example: | [Bis is a _mubli—)ine comment - | Tt cay span across multiple lines | and is ehclased within iriple. bisa | {jue | x=5 # Assigning a value to the variable x - x] 29 Whar is _o pip 2 Th simple terms pip is a package managet } I | for_puthon- TE lands for Pig Inclalls Packages" or " pip | inglall Python” ( bel | When working with python , You may heed 4o use external | libraies or-modulee that provide additional Funclionalities | bettend what the slandard_! libyary abbers These libraries I are_ctlen developed by +the puthon ‘Eomnnaunity and are [ availble for dnuone to use. | | Pip makes Yit easy to install a ST wl, a [and _uninsall these exlemal_libraties. [helps You Copyrighted by CdeWithCurious: Com classmate Date Page 3-1 Variables in Pulhon Ta Puthon variables are. used to whore values. thot can be used ole ina prodtam You can think of variables as__containers Tat | bald data: What makes puthon unique ie that uo don't need to explicitly dleclay } ‘ . . the type of a variable: You simply _cissiqn a dlue -tn a variable using the "=" operator » ] : For example , you an create. a variable called "name.” ancl assign it a_value like +his : name =" Yadnyesh" Here,"name” ie the variable. name, and _’Yadnyesh" is —I l4the value assigned +o it» Puthon will automatically determ. ipe the dupe “oP varidble based on the value designed fo it: Variables in Pathan can hal diferent types ob data such as_numbers vehinas {ioe oy _even more. plex _ohieds. You_can change Sie value at a_vari ime_by I Copyrighted bi Gdehith Curious: Com clasemate. Date Ts —C assigning anew value to if - for instance : qqe=25 age =26 + Upd tno the Value. of age. variable Puta alsa allawe you to perfhrm operations on varlable “for example: you fan oadd , aubshdel | -foulbi ply ar_divide ies tontaining nye Vin Jee: deen kambine, ariatiesiet Wi emis Faneewiising operators . For instance. 1D —y =| 5 ele 2 & Rant) # The value of X' will be &. greeting ="Hello” —s =) name = "John" message = greeting + ""+name # The value. of message! will sie, “Helln TeEp" Variables provide a_way to store_and_manipulase. to work with! infor- data in python making it easier (| mati ur program: Bu giving meaningful eat | | pames dn Variables’, you! Gin make Your cade moie_eadable and ‘ understandahle/ Copyrighted by CdeWith Curioys. Com classmate Here are. same_examples of valid iclenlifiers in python — : fy variable > count + total sum 2 al [- Myclass rH 1] c hete dre, some examples, of invalid identifiers : * 123 abe (starts with a dig it) ~ my-variable( contains a hypen) (a_reseved word) ~! Ph "tay var (contains a space) Underssanding and following these, rulas for identifiers in Python is_importan: to ensure. clarity reddability “and Hrapey Sundlinties of uour code- ] = al 8:2 Data Types in Python Data tupes in Python refer to the. di erent \ kinds of values thet oon be assianed to Varinblead They determine the nature of the data and the To a i opalations that can be per rmed_on them - I Puthon provides several burl ~ -In=data types, including : | numeria dictionay, Boolean, ae} . coqulence, dupes and_numeric has Integer Complex Nyse fae H and Sequence Type bas Shing Lisk and Tuple- | Copyrighted by CodeWvithCurjoas: Com classmate ae Numeric. Integer Dictionary Complex Number —— Float Boolean vere ~ puthon Dota rare Types et ie asl ie) Sting Sequence Type. List an Tuple ] ——j—I | 4+Numeric : | Pathan sup orks different aumeri data Types including integer: (Whale. numbers) Plocrting - clin hates” | t decimal oumbers). and campléx numbers (numbers with eal and imaginary parts) a. Inkegers Cin nledérs represent ulhale numbers | without any seiithedl L par For example, age =25. | b: Floabing - sink Numbers (Float) : Floali saith | numbers tebresent pumbers amin dei] | nint or Fyactone - Fo example. pL=a 4. C: Complex Numbers ('Comblox) ! Complex numbers have | q_teal and imaainan! _ toy ex: Z= Q+ar | ulhere jis nt Rim 7 = Copy righted by CodeWith Curious» Com