Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
43 views
19 pages
Py QB
Py QB for computer engineering student
Uploaded by
batatapotato590
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Py QB For Later
Download
Save
Save Py QB For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
43 views
19 pages
Py QB
Py QB for computer engineering student
Uploaded by
batatapotato590
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Py QB For Later
Carousel Previous
Carousel Next
Download
Save
Save Py QB For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 19
Search
Fullscreen
AGEN VT 2 Question Banke [xe [Ege cpetine : in_pythen ? SE sr a —f-2s _quns when i+ is called 5a) capl od _}-e28 dota, Known a6 pavameters into a unction . A Function can weturn data as os) Write the syntax of Fopern? F open C Filename nnode) | : S| use of ony Pour methods Sn math modu~ Hixesl ec al |) meth. qv ted = Returns the quave yeot ofa I number: x 2] moth. Factorial = Rejurns the fachowial number. 3) math Pro dies Rotinns seine sete WV wnatty « i$ finite: 2 Cheeks whether finite or nok ql Lisk Suit tn class SS aS attri bute cumenration Time ais) MGzeioporan => name of the class. RL. randvle! ef Li. bases cn a] died operate Explain ensures eens ¥ (reeves (ome Thisuiattes wkd | oan co Nene rhe wf airs « sinwea A se Sirs Neu ener load { te Wiiclniemacan Thies ottriibube aansolmeen es of the class. juple of the bose clernen) classe, EP ee Tn python +h |_easily identified. Namespace sparing conflieh iv abe o dyiteshene tensa eal Pee | and matrics- | of high level on thes use of namespace § onary of he class's Namespace. NurPy is python library that provides Support for large multi - dimensional) ana with a large collection mathematical Pumehons 45 _ ewer ay Sine olon . d namespace is names ave Un io _moatntaing the clarity || code.es | i : on ae | TL Desevribe module tn python with- advantages ? 40 Tn python a module te a File ongal | i—python code. typically ~containing d i OF Punstionds alabees € variables. HP) PAGO At ek Used $2 paganize co, Here cseible luni hl 4. ial aah aia 5 2 —Te_aveid Maming conf liek 19 Foch pmedule hag ts own nanaespace which eS Ra TS aed dielPimad W clits in Glee tal dio S WeTsMolaels Wiis, ama ce eee in othey it reodulksi pit eel sige : malin proqvam, Advantages = 2 eee 2] PRiews as ie 3) Incapsulation | 4) standard. library | 3 Third-party Libraries || 8) Namespace Management. 227] PSY ieee eee 8 opening a Ai) >| —__||1] Read mode Cx"! This mode ie the default mode for ed ng: odbilicen tis pens the file fox wea only. ‘Fo the Pile dors not ex'st, a ae Ss awatsed. 2) Write Mode C'w Thies miode wppensminerpaeetper Ovi delle docs Unotexis) aes create[5] Append mode Ca ii aT at This srrede jopen ihe MibeBen Appending . (fp | dye Bile does not ex's}. i+ is cveated Ff the Pile exist. new data ts written Jo the end of the Fre. [4) Read € write mode Cr+) Thig mode opens the Pile for both veadlny . | & writing Ra the aPy len does Wot le2e) Beams Pe illierren ved “NE aie EE Vemmensisth ids contents 4 are oveywriiten J J Binary wnode (bh Thig mode ppens the File dm binary model This 16 necessary Por weading £ wrihn binary Rilice aus as tmages ¢ yidews: | 6) jpese 1 modeCt’ > | Thig mode peng the File tn This 6 the default @nade Fon text Files. 3) Design oa python program whi exception if the Value enher del \ess thon zero-def chects HvalueCvalucd | voll rie eaas _ A alse Voluctnnen(” The valucilnaug: be . —__greatey Than ov equal to pero") | { | j { if ae | : cere int Cinpuke: entem daWaleees 255 a shi 3} aed. Bereinee ev ol diCvalice) | __ excep} Valuebrowr age egos tice) | lsc ® ! print(''! The value te volan) 1c}| write oa Python isreguannehs comeasenele i two strings - Sheil: Oriel ens Sete Oo ee | Str3 = B4r\ + Shoo pxint CS$r3) NV] | State the use of global with simple ee ple: ——>|| Tr eye mtg |g lolea ly SK eyiuens to declare +hoat ao voriable bhould be dreated as a global va rather than a local one, This changes mabe to that vaniab Any= OnE ae se ke iain a) tthe glebe) voriable » volth “he | dome i name | ae z ou 95 esta U 3 a = ae got e a def mai iilewallioe = cae. i"s i _ Bleiseu x a | Az 20 L | erinit” Before Fur call x 5", xd J I modify global dd a | print Co After Function cal), xs‘! *) ied) Me eine pee pene a class g it | object im python? = A class ig a bluepyin} Pow creahin i+ deFine the attributes 4 mether objects of +he class will have. * DCreate a class use the keywor class Myclass } x= SG z) Create object usethe class create objects: fan Myclass on) print (pl. xdpr Persontd Eee; closs Person? Aono e 25 OTe Le Ee Sgyel = Sof ‘pif a ae print icip.nam ed Cen miaCe oe age) Bien John lI 30 13)|| states the use of python class. parameter “selfu to =| 575 elf ts used to wvepresent the cet SoM EPhicw alas with this ingtan— can access the attr keyword, you ibutes the class In python. € methode of Dwithout the gett pama mieiher siyomluee line able +6 accessiithes yan lee eer AM) || AGa) iSite E Sarasa ae mem Ee Liisa ts ytho n ae, i] Read tmodc Cr? 2) Wortthies nadidie lw > 3] Append rrode Cad 4] Binawy ceode Cb) State the ude of mea d/coi gpa ¢ Gir Funétion in python rors Arle handing | mace ha= Lt pee acon Ryeewe | Othe veodt) Gur hs Josed fo Ivead (a Specific, id rerbts of “bates Jc ees iF no ize vs pecihied th veads the endive file JRohken called without an arqurment it veal ere icon cup een 2) _vead\ine 6D |S RBA nie eS Sou hs used to yveada | tach time {i's called 5 Mh reads ihe oext line Prom the Pile- 4 J 4 a oe ic ere es i : a 3B] i} metus a String containing the lin SS eens Bs J Describe veer dAcfined Function jm python DA user—dacFined Fur in python 1s a Function +heat ts created by phe users zy) i+ ¢ block of code that can be sre throughout a program . r 3) user. defined “Run are eveated Um ‘deh’ keyword Followed by the fen & a colons 4A) The body of the Function hs tn the Fur ends with the “veturn! Ae Explain tne Following package example. a => rum Py ; NumPy tsa Python |ibran dacs oa variety ASO Gan =| Twat HO | ont i - : comp) pg Vet pawhiewlarly well ouited Por working with Grrey¢ 4 ake (eey ms toport nurmpy a8 np ix, ig array = Nprovray Ch 219.4, 695 | | ——_anity-= opie print Caray. ¢hape) print Comray. dbyped _normay sre | pea OSS ie Cone pnhe4 pe crise aa [a Sait ate 4 Seavey as louit on bop of NurePy & provide additional Pundhlenaliti! Pom scleral ttelecenam uking iF jretudes modules Por optimizations integration interpolation, \inean algebra datishies d prove, boa ina port numpy OS np Prom Sel py iroport inthe def FCx>> yeturn x** 2 result > integrate print Cresulta | PAGE NO. ATE: bo) Pos 0+ 333533333339 Bead | | 3] Pandas : { = Pandas tS a powerful data poo nipulation 1 be |_& analysts \ibrany Pow pytheo: oy provides a nse Bice tose Uflaipiin sibinls itso mereEnel lay | Week woth wiructuned | dele, such cual ft gabutar data ¢ tinoe evict: Pandas is 1) | widely used Por preprocessing, cleaning ii Ex i caport pendas as pd data ~ “Hare! C'Rar', Bob’, Sham! ‘Pge ) ae 2aS eee) 38]. PE eet 2 LA” ‘ae oss See) print ¢ af) pales rlame Age coy Rains ie ees. Pune du Bob ge as 6 har 3s voK Pay Matp)o tile Matplosi Woe ais ata plotting lib creat ng stahic a eee ie tgualizations (nh Pythome hing ly welly gutted «Por eveatio bar charts 4 isto grarosiro port adits (1 oa big “pli piel ¢ 73) os pit. xlabel¢ % +aae\ Sa) lb. ylablel Cynanis™ ) Er laes Jed lei Se tinwis Veta aivem ip Done ipl. show “W]) Greate a clas sDehd dene ae narnc , departvnen bs dilbvell sol AMBRNelaes: ale table wethods For weading é toeiding print ing AOE MAS aticm mene Students > i def Lote. Ceelfi name, department vollns): se\)f. name = hame Self. eee department Sel Ba rel 2 yell ces 4 aecF cread_ info(self)? el\finame = tnputC" Enter Student's Racy | Self depariment: inputt” Enter siidend's Aepavimeny)) &e\h. vo\l_ oz input! Enter students roll no), def mint tpPo C&e1F)* ; By Cas) cde i hakesiabetnne, + Leica laamcinne) PeimdC Department '', gelfs deporment) oi aC RON plumber gelf. voll_ne ) f reRO oe Bisgend| tad An he OD! print GC \n brudent Thformation t Stadent. print _infe > al Btr.= ] Enter | 6tudents tnatne =” John 3 Enter students departenent * €® Enjer student's aires sera) |2) Tnheritance in dSubclas ome ne 1 eee | the Punchionalidy fF she Super | Staden+ Trformatioen | ehudend = amet Joho | art ment? Co Paola gadfaleurtls can see Ea TA raises ese Expl One of the cove conce thon with ex tin CooP) a : - + t languages fs jnheritance. thon evreate iS a mel a thot allows you bo hat are ased on existin e\ a\so abilid @ cx: hoving the chelates ieee yo in class ef tna S e\f. nimal * df, name DAME I> Ma Ee(Bs ee os cre ne 2 pa CS Tine! euihVirn a ley en a class DoglBnimal) : clef speak Cself)* pao C* The doq barks) || elas cat C Animal): | def peak (Self) ' | print The cat meows ‘) wy dog Sap by ce et dione: nn beads Say GN Pe\ ex GD) may. dog - speak) iocsiet See dat, Speak © | 2 Went | The doq barks . aaine cat me Ows- 20) write a python program whieh will throw exceprion tho the value entered b LS evs | till Ve plc in at ra mews DS = Ans 9's 2 Define a Function in python & give example : ed, (See aea Date ~ Rare) =" “Ex ~ ti SP rt Be ot greet Cnamed ! oe e ape CR Hello | framed apes | © 1P = Hello Roam = 22)| Explain pene? method f waibe gyntan. a => | Tn pytron the Volpent) Runction is used | +o apen o Prle & veturns a File, object | whieh provides methods 2 attributes MMIRoy) Beso launtqumeps Wnty cine) Senmem | | Syntax = open€ File , mode) 24) Explain sthestiMathe Module tn python me ; f four methods: = The python yoath module hs a .buit 7} a module that provides access to A Ao ae provides Af matWemealiaa )) URih A Net ieee 4 trigonometric logay Tthrale ¢ Functions . exp t Pouv methods, ta) 18.40-¥ (>it LTS gli Rimetom nae Square qoot of aThis Punction returns thr po- Wer oP fan etme See FSM eeu be es we, Function vetuyns the ee expo nentia) of x. 1S inc Ne nans cum etic raver) vetuns the sing a of a number. | gn} (Ee pion Sweet foetr parameter in puthon Pe necnetaeondelee bt sO she self parameter in pythom ts used to eae oe the current instance ofa elass - A) tt ; used to accesS Wasntables miner A tonite allaisse 5] The self pararctey docen*+ have to be named elf. but Se paeiso bcm aenminaser parameter of any Pur jn the class’ Fal Ex = class Person * d efi tnt Céielifs malenreiimongioman Self. name = name Self. age= age a } lets aeet Cgetf)* a Gh Hie) lon nepey eee mnie 126 es tee pect px 2% years old ". Foymat Cself. name Se\f. aged) p =iperson C' pam\ 28) yo. great ©)e + : name IS Ram 8 om 25 tars old. , oi Ar. honest Explain method overriding with an a- raphe? ( ad _ Dmethod overriding is « Concept in SSF 2) Method overriding is a feature of python that allows a Subclass to provide its own implemento tion of a method that is alve- ady defined ‘ns its parent class. [ a) Jeis ts ‘useful when you want 46 provide f |. a. move pecialized x customized version 5S. yet (Popa cle etch au) eaemeerelbaes Ex: class Animal? def make Sound Cself)? print Co Anima) ound") class Dog ee 8 def make. sound (self)! printC woof!) class .ca+ CAnimal) | def make. sound Coelf)s print Ci tteowl |!) | dog > Dog) cats Cat) dog - make _ sounde> Ge, Innalkc s sounded ies yo poate ah 3S Meco w |, 1 schedI | 24)| Explain -Yhe namespace & scope of variab! | }o python: __ TL namespa ce ha ganz | DA namespace tg a Systero £ provide a. way to @ccess names Cram Fancthions classes e+e) tn a program: ; 2] Namespace act os 4 boundary +5 en & aveid nam we tha} names ave unigue im conflicts 4 3) Python hes Four arfReren} types of Namespaces: J} Buit tn namespace 3] Global namespace 8] \eca) damespace 4] Enclosing momespace |2] Scope | D gcope refers to the region of a pyre where a parvticuler namespace is dive accessi ble [a] In Python , there ave mainly three Toca) Scope: Variable s defined Num Fur have a local scope. They ave _a only within that function - 2) G\obal Scope= Variable defined at Jevel_of a module ovr explicity dee as global sat PAR en ba ey Senos They ave accessible throug F re rodule.- [3] Buid-in-sgeope: This scope contains naz I mes of built -in- functions exceptions 4 e | 4ypes . fy tg automatically leaded Miner | python Starts. Bell Explain try -except blocks statement in. 1 python eee eee ee =| 9 Th Puthon the * tyy- except’ block s | used for exception handling - | FS atews you te cateh 2 handle excep | Stone way Wiath lp cede lduintmalne—eeeeer Eee es ee eionmennee |g] The excep} block contains the code that | wil) be executed jf on erver occurs 19 = the try block. a) a] Ex = try: i aceult = 1ole printc™ Result” vesult) i enceph Zerp DivisionEyvor * | print C° frre? Division by 2ere" i} eee Error! Division by zero.
You might also like
Knee Ability Zero Now Complete As A Picture Book 4 PDF Free
PDF
94% (69)
Knee Ability Zero Now Complete As A Picture Book 4 PDF Free
49 pages
CompTIA Security+ (SY0-701)
PDF
82% (11)
CompTIA Security+ (SY0-701)
405 pages
Starter Set - Dragons of Stormwreck Isle
PDF
93% (60)
Starter Set - Dragons of Stormwreck Isle
94 pages
Tactical Barbell Green Protocol - K Black
PDF
100% (9)
Tactical Barbell Green Protocol - K Black
252 pages
Kris Gethins 12 Week Muscle Builder Ebook
PDF
100% (14)
Kris Gethins 12 Week Muscle Builder Ebook
45 pages
Issa CPT Text Book - Unlocked
PDF
100% (16)
Issa CPT Text Book - Unlocked
796 pages
The Options Playbook - Brian Overby PDF
PDF
95% (21)
The Options Playbook - Brian Overby PDF
343 pages
Old Man Strength
PDF
95% (42)
Old Man Strength
122 pages
Jay Cutler's High Volume Training
PDF
92% (60)
Jay Cutler's High Volume Training
65 pages
Kettlebell Strength Training Anatomy
PDF
100% (10)
Kettlebell Strength Training Anatomy
217 pages
The Shotokan Karate Bible Beginner To Black Belt, 2nd Edition
PDF
93% (15)
The Shotokan Karate Bible Beginner To Black Belt, 2nd Edition
293 pages
Bak Mei Kung Fu Manual
PDF
98% (56)
Bak Mei Kung Fu Manual
61 pages
Grapple Strong Josh Bryant Compress
PDF
100% (10)
Grapple Strong Josh Bryant Compress
128 pages
ISSA Strength and Conditioning Performance Psychology Main Course Textbook
PDF
100% (11)
ISSA Strength and Conditioning Performance Psychology Main Course Textbook
586 pages
Training and Conditioning For MMA - Programming of Champions - Beloni Correa Dielle Dias, Stéfane Oliveira, Everton - 2022 - Human Kinetics - 9781492598619 - Anna's Archive
PDF
100% (7)
Training and Conditioning For MMA - Programming of Champions - Beloni Correa Dielle Dias, Stéfane Oliveira, Everton - 2022 - Human Kinetics - 9781492598619 - Anna's Archive
433 pages
Squat Bible
PDF
97% (32)
Squat Bible
177 pages
Hardcore Bodybuilding - A Scientific Approach - Frederick Hatfield
PDF
100% (10)
Hardcore Bodybuilding - A Scientific Approach - Frederick Hatfield
503 pages
ISSA Corrective Exercise
PDF
100% (10)
ISSA Corrective Exercise
268 pages
Beginner's Guide To BJJ
PDF
100% (10)
Beginner's Guide To BJJ
56 pages
Shotokan Kata Up To Black Belt
PDF
100% (19)
Shotokan Kata Up To Black Belt
38 pages
Analysis of Shaolin Chin Na
PDF
100% (23)
Analysis of Shaolin Chin Na
384 pages
The Power of Shaolin Kung Fu
PDF
93% (15)
The Power of Shaolin Kung Fu
220 pages
Japan's Ultimate Martial Art - Jujitsu Before 1882 The Classical Japanese Art of Self-Defense PDF
PDF
100% (8)
Japan's Ultimate Martial Art - Jujitsu Before 1882 The Classical Japanese Art of Self-Defense PDF
276 pages
Va Form 21-526ez
PDF
No ratings yet
Va Form 21-526ez
6 pages
Python Handwritten Notes - 1 To 2
PDF
No ratings yet
Python Handwritten Notes - 1 To 2
36 pages
Python 2022
PDF
No ratings yet
Python 2022
12 pages
3. Functions, Modules and Packages in Python
PDF
No ratings yet
3. Functions, Modules and Packages in Python
12 pages
Python (Assignment 1) Shubh
PDF
No ratings yet
Python (Assignment 1) Shubh
12 pages
DocScanner 9 Jul 2024 10-39 Am
PDF
No ratings yet
DocScanner 9 Jul 2024 10-39 Am
17 pages
C:/Users/Rafe/Appdata/Local/Programs/Python/Python35-32/Scripts Object and Data Structures Basics
PDF
No ratings yet
C:/Users/Rafe/Appdata/Local/Programs/Python/Python35-32/Scripts Object and Data Structures Basics
16 pages
Pyton Notes 2
PDF
No ratings yet
Pyton Notes 2
29 pages
python m 1, 2.pdf
PDF
No ratings yet
python m 1, 2.pdf
12 pages
Python
PDF
No ratings yet
Python
5 pages
python unit1
PDF
No ratings yet
python unit1
39 pages
DocScanner 18 May 2023 12-40 PM
PDF
No ratings yet
DocScanner 18 May 2023 12-40 PM
18 pages
Python , part -II
PDF
No ratings yet
Python , part -II
16 pages
SCH_BPLCK205B june.july24
PDF
No ratings yet
SCH_BPLCK205B june.july24
17 pages
python unit 1
PDF
No ratings yet
python unit 1
17 pages
Python Assignment 4
PDF
No ratings yet
Python Assignment 4
12 pages
Python ? Handwritten Notes
PDF
No ratings yet
Python ? Handwritten Notes
73 pages
Python Handwritten Notes 1701013067
PDF
No ratings yet
Python Handwritten Notes 1701013067
73 pages
python 2
PDF
No ratings yet
python 2
25 pages
Python Lab Manual
PDF
No ratings yet
Python Lab Manual
28 pages
A Quick, Painless Tutorial On The Python Language
PDF
No ratings yet
A Quick, Painless Tutorial On The Python Language
54 pages
Python Scripting
PDF
No ratings yet
Python Scripting
108 pages
Introduction To Python: 6th School On LHC Physics
PDF
No ratings yet
Introduction To Python: 6th School On LHC Physics
24 pages
Python Ass 3
PDF
No ratings yet
Python Ass 3
7 pages
Notes On Function and Modules
PDF
No ratings yet
Notes On Function and Modules
24 pages
New Doc 10-11-2023 22.03
PDF
No ratings yet
New Doc 10-11-2023 22.03
13 pages
Introducing Python
PDF
No ratings yet
Introducing Python
108 pages
Python For Data Science (Slideshare)
PDF
No ratings yet
Python For Data Science (Slideshare)
54 pages
Intermediate Python by Yasoob, Muhammad Khalid, Ullah
PDF
No ratings yet
Intermediate Python by Yasoob, Muhammad Khalid, Ullah
93 pages
Python important question
PDF
No ratings yet
Python important question
21 pages
Baeck Ernst. - Analysis of Structures. Book of Examples
PDF
No ratings yet
Baeck Ernst. - Analysis of Structures. Book of Examples
158 pages
Python
PDF
No ratings yet
Python
13 pages
FastLanePythonF2018 PDF
PDF
No ratings yet
FastLanePythonF2018 PDF
171 pages
Python Ut2
PDF
No ratings yet
Python Ut2
26 pages
Python Programming Notes
PDF
No ratings yet
Python Programming Notes
33 pages
Analysis of Structures. Book of Examples
PDF
No ratings yet
Analysis of Structures. Book of Examples
160 pages
Python.imp
PDF
No ratings yet
Python.imp
77 pages
Print Python
PDF
No ratings yet
Print Python
22 pages
22616-2024-summer-model-answer-paper
PDF
No ratings yet
22616-2024-summer-model-answer-paper
28 pages
Index Important
PDF
No ratings yet
Index Important
18 pages
Pysheeet KR Readthedocs Io Ko Latest
PDF
No ratings yet
Pysheeet KR Readthedocs Io Ko Latest
269 pages
AE1205 Programming and Scientific Computing in PYTHON - April 2022 2
PDF
No ratings yet
AE1205 Programming and Scientific Computing in PYTHON - April 2022 2
222 pages
all unit
PDF
No ratings yet
all unit
7 pages
Python Notes
PDF
No ratings yet
Python Notes
32 pages
Paython
PDF
No ratings yet
Paython
66 pages
Python Sem2
PDF
No ratings yet
Python Sem2
16 pages
Python: Finally
PDF
No ratings yet
Python: Finally
10 pages
61 PWPCombinedManual
PDF
No ratings yet
61 PWPCombinedManual
86 pages
Python the Essentials 1731972875
PDF
No ratings yet
Python the Essentials 1731972875
11 pages
Python Handwritten Notes Book?
PDF
100% (2)
Python Handwritten Notes Book?
77 pages
Python imp question
PDF
No ratings yet
Python imp question
17 pages
Python Alok
PDF
No ratings yet
Python Alok
23 pages
Oops
PDF
No ratings yet
Oops
67 pages
5f2ad9d8-d192-44df-8f68-88ee0663e678
PDF
No ratings yet
5f2ad9d8-d192-44df-8f68-88ee0663e678
14 pages
Python Basics (By Mark Wickert)
PDF
No ratings yet
Python Basics (By Mark Wickert)
42 pages
664 PythonBasics PDF
PDF
100% (1)
664 PythonBasics PDF
42 pages
Vital Judo Throwing Techniques
PDF
100% (2)
Vital Judo Throwing Techniques
193 pages
Strength Training Anatomy 2nd Edition - Text
PDF
89% (9)
Strength Training Anatomy 2nd Edition - Text
151 pages
Issa Ebook Recovery
PDF
100% (2)
Issa Ebook Recovery
25 pages
Vet State Benefits - NC 2019
PDF
No ratings yet
Vet State Benefits - NC 2019
19 pages
# Series Episode Name Original Air Date: END Newest First Disable Color
PDF
100% (1)
# Series Episode Name Original Air Date: END Newest First Disable Color
20 pages
Muay Thai - Trainning PDF
PDF
91% (11)
Muay Thai - Trainning PDF
416 pages