0 ratings 0% found this document useful (0 votes) 19 views 17 pages Python Imp Question
The document appears to be a fragmented and disorganized text discussing various Python programming concepts, including control statements like 'if-else', loops, and functions such as 'find' and 'count'. It also touches on data types, operators, and the importance of comments in code. Overall, it serves as a guide for understanding basic Python syntax and functionalities.
AI-enhanced title and description
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
Carousel Previous Carousel Next
Save Python imp question For Later Puthoo Guestion Book
G13 | Descathe the sale of Tadecintinn lo-Rthoe Pern
——>
i Etoclentation refers to in spaces. at Hoe beginning of
t
[ona is otieel aoe tae
i
in pater natalaton fs csec_to define block e
ition od to.
i
| extthin and outside cat Heng.
F Consist i ton acwoss the Cade is
Necessary Lose Moacsth execution’ _ 2
+ Lxarmple % is "7
if Bo:
priot C Piueis_gueaten. Har oa Yt invent
\:9 T ehithes ssujedas! and. exarnple of rreotk ond condinue?
=|
1D Cootinue ee -
=The Continue... _stolernent in python cetusns ihe
ps Cantal to the beginning of the while Joop
| —-the Continue Stolernenk. reesects all Une -remchanis
Statements An Curscsent iteration of
= break! Loy aititysy ee a _
Tos Va mmagetsy SY 2 -
40 font cbse =<
break 1 7
Print
Skipping. any. osemainiarsy. ‘yeretions When _
Ce¥tain Condition is me
ailain in_detoil about
er
id Qythoan Pregra: es
on™ anage @ the
cine.
pater | Dun sakuicbrendal for 0 PY 9
+ o2der in colhi.ch— Ababeenin corre encecettad hry
are ye oo
= Ryton & provides. 1 Hoover aia. np tyPes = ef Comte
Plow. -stauchuses —— "HL
@OrConditiedal gtabernents t
Ve i ox
Palee. hai dr —
oj aiblerntl a= :
ss The tf Statement execates, acblack-o! code 2
P He Condition is Aree \ ata
Lg t= 210 23)
iL ame a
_ Perfo (ack “grcectter than a
lip alee alate de
| the if-else Statement | Perovic
_ | es onvaler
block of Code oe Won 16 false
tf C.4.5- MSS
| ix HIG 2 voiiy :
i
i ae Crete esd oy 2bilai aoeina Stabemeat $= -
P __@ easing Stolernent $=
D taops ce Ose to “execute et block. of Cocle mm Malkiple
| Hienes
a) Low Qnoe 8 Tk thorates over @ Sequence.
= egg io range (s)i_ ape
Eg Lory t Lg, 2IP <
Point 1) 2
|_| by tphile boop th execertes tes ablook ‘of ¢ocle os Son
| = Suntox §- Por wendable, jn Sequence
as
the CanclPtlon 1s terre. )
! egt— K2o | [eps o -f-
I while x<5: |
©
: yj
Paint (x) +: = a
I Ybetoly 3 4 [
D)ceotique Sholenent $= th skie: the canes coat Hemestion,
ancl moves to next
Lege
| waa | a
- Pxiot G
iServes eune_placelnclel er
block! —
0) Bass. Statement a
Does oothing- ands
; Cool 2.
head Pe cee
D eftine Se ee pop
5 tenth, parakeet
| “= identity, oped teins. ate sect to Coen Peres
Hee pnemoncy
| \ 23S ~ 2 ——
{|
© exech 2 ob}
| “(2 Ay etor! Vailas. ance egeral.!
ical Panini in cheek onbebbes b=
i Operands acce Baicnienam Hob...) _—
— there are tenn tupes oP Sey OPRerratexs
Ly is !
2) fs stot ii ving
| Oise St vebusn. ee yf ta Belo Ties pait
! +0 the Bame obleck | io enemy
| @ ie ook ib crelarns nit is
ig Nok As Vartan
does’ oot Point | a us
Ihe: Sane.
Mem mg fe abieok ioH
-—T Fancak mobs
| 3 membership oPerator 8—
_
_ pT Patoon MemMberSwip operates 1s Used to
| test cohebher cy Venable or value 16 Pound
i * . : Foun
| + within a sequence Like a@ssri My) Mok, tupo,seh
| eete. o9 not
-——}) i
| =A membership opemator -secluces te elherct
of searching an element In the List
= there are two types of cnembesslin coer
Ay joy ee pS
|} nok (vy
fo _ -
| Olas: tt vetuens true tl Value te fount tr vs
Orin sequence. atherevise It veturns
false. a a
@ockia t= Th mefurns. true tf value is nor
H
! fa Mist o¢ IO Sequence otherooise _
joi redeem Saige
ag]
21) ips t
+ —eturnioy Joleges_ quotient. -
mention the Use of JA), %/o opecrcrtet Ww Python
— Tt Is used to Perfo floor civision,
—|__
|) wag ty Represents exPonention-7 paplatorett
be_changed aller Cs peal doc eo
Ris esl 25 Fgh gatiate
ae weal
y jenmutable because —
use ee
key etn clictionarles—
—_ pa eel ee
— pn ~ aligmph ba edadily tuple clements—“e2'S 25-0 OTe
Caron.
—— if-else s sete -
— Tk te used to-execerte one block ok Code tf G-:
is tere cine scindttien 4 oe ~1T tine Condition
je Paleo. ion) 3H if
aie ay ae if —_
— suntoxs= ff condition: -
ao stsinit Atcade ta be sxecetbed Uh condtio
et “ou:
e\ge : nis
niet
« esate Rin false
mega ge = |g
—i aagey = 12 5
=“. Sf
Print (you axed! eligibla!'to vote oe
| elect_| Condition thet evaluat
ID -aifeelse gS
——This_is_used cohen eouitiole —
[ =" multiple Condit
- feed pbs checked, Sequential coly for tad
es to terue cafll_ex oo
crest twill be jgnowed, Cate cmd
= Suntox s—_ Tf Conclitions a
—____e executes If conelitiond fs beco,
elif condikiona.
|b ewe to erect #2 eondition 9 ta
- Pls er ee
4 AE Cdcle torexecaibe Ff none of eonaiten
— Are. Serese
— Cxarnple $— Marks = 25
! TP merkss = 3
“Piot (Grader B+'')
H ell cranks >= 802
Paint (icrnrcte s 0")
jsesi
men le ih 3
»
Describe use of Lollasuing function Finclc) and Count)
1) Pind c) 3— Stl —
| =the Pind 0 function is tisect to search Rr a corel or
fetker inside astatog.: 7
= 2 tk je found tk welurns tne Position Cindex) Cohese
sk _ stants. if {} 16 net found., it weturs -L-
= suntans— Stying.Find (subsiaing , start, encl)
BYSSIOECT =the ceunkly Funckfon Counks hows many
[vines a cwond x letters appears in_aslaing,
= synton t—~ String. Count (substring 1Starsh, ena)u pha
NetaiLiopel {sealer toawalue of 8) ———
el fox number tis orang? CoN ; D:
—|_few Vie 100 2 (230k Crusber 20:8 )4L
i if number we fe= 0%
brea
for cleolaration ‘ ne
i that Stoves clatas —
1 — D variable ae Balconies aodac.
[a Bias Toe acetate Les —
| 3) epost start eaftha dette oa Unclerscore.
| 2) cannot Cantata. Spates: Oe aN Special sumbe
t &) Reserved kernserds ance Natalee to Use
____ 18) (paventions aaS cae -- oa
st escxipiive Mam heage)
—___||_ 2) Poliows snake = 2005.0 oa 3
2 a
Nf Aaaranges) function ja Python is Used to generate
_Sequent& of nambers-
= This. Commenly usec in loops te iterate syevo.
Gequence of Oumbers
=I srange funchoa aunibers. Orre nese eA te ol Bu
re Step Value — step -vertreis—
= Default ghee te £ if “not paoutaled.
__ = Default stot ta crange4 function _is_o. if store
Value jg Not Parovided! 2
= egecierne tegen Sar safe nes
| genes ee oreo.
_==_Sunkox $= ____+ 7 —
__Tange (start alata rr
. Rat i in ange Ct, \o, D8 oe
Point Ct}6 tn-butlt bist £ inci ob alan te
=D tisti oo pythe fn. o.cellectl an of thern thot
Con Store _mulHele values = —
~— Puactiens = ;
2) fosertt) -
> Yemove Cd <
a) Pope) ‘ — -
H) Soxte) Hey
6) yeuersec) a,
1) Countc) t
%) Inclexc)
SB) Copy cy 1 ;
siactemres to) extend ¢) 1
5} Define types of eorements fo pyltoa saith Syria
Tn python Cormnents | are erged to oxbla ia Coole
and make fH easier be understand. —
= Cocamments_cvre igndsceol bohen Pewepreinn spans
—=theve crse tive types of darren “tn Peython
je-Bne comment (Hye
== single = Line comments. Ore Created simply by
— eee eee
= "
= Suet to this 1s siagle Dine cane Cannmnenh.LS wane aa - -
(2) poulti tin ment om) So poe
— multiline Comment is piece ae text endoseol_
eT
| in C8) terfple gue tation maxk> « -
oom amen: _
T= Syntaxs= rtinie 1e_coulbi= ‘Une —
Paint (1 Semese r)"""
fe chavk woke. on silicide sith example, _
—7- slicing _i Gtechoique sed la Pytnan to extract
asvecitic Pamt of Sequence dike a teria, Li i
or tuple.
L ab allors (you to layeh A Poatian of dag later
Wi Hhout rmedifuing Ye _crigioal Seatsance ——— _
LE she slicing apencitor Arete ubset of o
qUenc Coen slice.
- Guntax a Sentience[ raualeriall Lec)
2 Slow a— The inclex chew slicing beai
| send g- the index enbene Mein g Biops
| __+ stepe- the ‘gap! bekbeen elements and fs a
H default 2
I
1
p Pxs— texto" Hello, Putran bk”
Orvint (text To: Bl) —
\e
— Hello pe teI dO) and
[Fela Hoe atestag icshons a OSS and
pene a y othe en)
| | a
| of ts ingle Stern in Hoa fick 0:
| — we can Ingert a
i
GHime _esith Hae apperalé).! 9 -
4 Lege = tye soimrr'} _
' i Ohappend (poles? silinss
1 | Print (0) _
| Olp a [ise Sime! Poly} ie one
frat adi 33
gee Me P1038, i tart?)
Se fogess' ‘
Ml sins ort (6 male")
= Qlps- [1218 ‘Pine !woBp! “tn ‘Potw’)beplio. any Pak. _Pecthures of Pytoon. regina
[D Basy rhs deere and USe 3— Similay
Python uses very Sienple..and clean Syntax”
“ough Fox Programming. purpose. Heace,.earn and use
_ the Code be demes very easy ‘o python,
fe Toterpereted Bangesacye —
_ pat thon execaies Cade Vine by One, cht oh
makes clebuggiag 2s jean Camper to Cam piled
| Janguagyes fike Cor §ava _
| ~ -
___8) obieck-criented Cb Pickresinite ete = _
| Python Supponts both ablectomiented an,
_ Perocedtuncal Pano. oO. 64) @iving clev
! Dieyibility oe -
___Puthon. “Gadde cues te michelle Iuscelocde
| architeckres coitthoct_1 raed fication » making, Whigel ye
|__Powtoble te ts os
| O0. Dalaba base_Goneativity: - b
Ba a Supports various databases
—__||__ Di bevorei SoliteS ana saat chemtp= ee ee
I "iL Blak inp ante SO Dut eok22"))
+ Sube = CloatCinpot("
bieek.
—___suba = float Cinoul ttenke_conie Det SS =
nv
Ht
__ Sain le dl
|_Penceatug =n 3
if Perten tag ZQo%
oe CBee boa naa o af
elit Cex centage: =8o% sete yomebta!
Grades "A"! _
edie Dencentage d= ‘0: avi
a e grades"g"
he
eri. Dencentaye ye 2 asloscher main
ps0 Jen tiew mds . 7
el iy _ ——
i elif Pementage. Bboeeliad age sh.
I Loe _
| ea eas a iWode ook
a 1 we
errade-"2"" _- |
i 2————
OE Beptatin any Six tuple function.
— 1) leo Chuple) = Return the number of olements in haple
_-—_ | _=8g.2> t= (l0,20,30,440) -
_ | ett test
_——{___olps.q
|
——restrs) e Qohas Hho erp eceiatoi io tuple.
= 09s t= (5152090)
tl "cast Laat) _
Olp & 30
9 mfoCtuple) = Returns th “oats + element io tuple
|_ —egs- b= (5% a)
4 Daina Centn CLD
| Op 25
appears Pn the tuple.
~ege- baCi9, S08, 4s
Paint (b.Count(2))
| olpe8 pete Sf oii
| 5) tuple. fades (uslue)2—Rehrins the lst index inthe given List
| = 24 fo be (dogo .B0,40)
4 paiok ( b.index(ae)) =
OJ/E%- 2 _ -
I ee
= | 6) Suro(tuple)2- Returns. Sum ft all numextc. “elements
| fo the tuple. oo
7 eg. 3— ballv,208oreo)
| i Defoe (scorn (t))
. o[ee- beTP hak ie one ofthe rnast Used-<
delete Plemns inc Dish
+ the fist ahtadupe in puthas i elas
: mio
Q4y) Explain Mist oabahipes fo.cebell Pecos. —
ist is clewred Sect jo Paton |
CD-rsec datatype to On
» Ll
is ven flexible nea liace af ony catene io Fe ioclad,
Sike 20 ory
|
(2.901! rotate dine fot a) excerple
4S) Soo boop Tt) emit doom .
— |e3. us ciety 9 (say ve 2 -
oon
| x pd) ini