0 ratings0% found this document useful (0 votes) 73 views28 pagesCs Notes
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
Ze ere are. aie ‘n Python ? Hows many -bypes of
Sve pad the. difference Tree ac
9 feysrk
| PredeCired and ect i cise eserves hth
a holds ae z re
>A particular name generated b J prog ntact
fne_o yarfable , fry aa
[=> Can hae nos , Ophabets ots charactsre) ale eee
literals are trove?
Fl Python Aterals ane. pee ‘ype and can't eld any
tore hase data
%& value type. These are usecl + stow
| far Xe source ode.
Types of Literals
s AheraSs acts Boolean [theresa
| Character [ittnals 8) Float Ltteraly
|Numenitc [erols __¢\ Null L2terals
gsr — $$$ eet
Ques), Untaort usll he the size of APse
, 66 9, Fy
re
Nig Gas Lipa iy
ME Reva Ni ay Gass seen tee
—Ouess) Hous many, ae -staing are shore ato pl ian
ge of 2
1) stagle Lise stings “2 Multiple Une sings.J
print Nome is? Name)
Quese) NMRA Te ic ex coy = fpsitoctoll
Te variable Name has not be
Nolue ty So it con't be. Progra4 al BAR. teen, = af
oe | Condéifen
| Comte’ long). Sbokements
F =, pegaves & statements Ped
| TP the condthion 2 Oe e \sep
-execithing statemerks Ond che ckfno
es Prendelna a 2 lind a
Shot emmenk 4 __ 2.32/85
[WAP tn ' input. ence to predict ance
| put bonus if soles >50,000-+then bonus will
wt | Lbe 10% of -the some.
edleaic “Reuieeiedstoges ee
La ae S00. Gee8s A nk AN cee
bono = tines 26h sie' 1 All
ba es
= ig & cfioth
a.person
ap to check otts ie
x is ° e “ a
= ;
AE Qa 3
oe i 9) i
ee = ft CEng “4 Ey tor a veat
a 4
eth pi (Ts a Leap-4en
_| elo s Es
fe spat (Tt is mato Leap-year”)
O08) WAP b> check whether the no. is Qositive o
3 eas 9 a ( aan
____>>_ number = Ant. ng S( Fycter anu
| +8 :
5 number > © ¢
print (Sere {s_apodtive x0."”)
LOIRINENES aye
petra any task. Task man tye <°
Ring the. condi
°,
enor repeating 4RoHt Purhon s orts & of Python * ae ———
‘uthon Supports > types oe _—
© Empty ctatement dei oS
: le
—>_ Simplest statement . is |
> Deed hotkig, written by ust word ~ pass. —
~ Dees norkaing and an ort en
Se required, where syrtox of python requfred presente.
of a statement but where the Logic ob the pagan
does. i a
Simple ctatement a
©
J
Single executable s-bockement. ___ ae
23. Name > jnouk ( Exter_yoot jnaiine?) ae
pant (Name) J i
©
Compound statement i) a
(rroug of ctocteoment®. execuded oa outbid
Wetton -th_aspectite “ pasttern. 2 agle Be
Aad. header which begins tas key toord, [Runction —
= gudienda. With colon (2). ok te x9
Pp Cowkains ot one OF maze, pgten sdackt ments Cache ent
__fuside re header Mthe. accent ii ie
= must be at the same evel of factentoction
Lbs
ib
E25) Since rent! oPlainetdnlensnat Seeoi
cis fon or Bleckao it in current
i Q specs 18 ori above pe Con wobe
Se dh. every sibject i fo
aj a
i:Ht | Beroc ond Exce ptions 4S wokeee
> Geror_means os prograrime. C868
Me A festansc. > wofthee program’ aitiiiast
oe yo wd. “conn e not produces,
the expected output _
| Exceptfons ast those acne uakich peas
pao dating the execution time of progmannim. he aid 2
Fel Typea of creo a
a
é as Romance Eris 3) save ces ots jr
(a) fool Fotow tim Loos so a no. Jon ae
= ean (piso ee) Syntax Brron oo.
| Dr odcurs before. the eeee tine of a pmgramn
PAGEND. &
a
Occurs. due to MNolatfon, of program Lang, i
rouble. i.e. rmisshng parantiet, ee, utd
operators the * ;
20: n= int (input (“4 Gusher quy ho.” )
i nk oe
print ( cube of number +”, 0)
a
Psiychax error due. misfag parant-Reats [A
Semantic. Beror ‘ a
=
P| Océurs then ctabement is not meaning hf
@ &9,, $ SPlo. Plays Fano’ _Is syntattco tly and
“Semadut cally Correct but $ Plano plays Sita?
Syptact correct but semardicalhy —
On XY 2. S@mantice “wcorrect_ becasse
; expression can't come: before the <— (|
| operator.
“S !
ee
.
Occurs then _progrars. ae _execuch = Succes lly
hot ag covrect out
f A aty. OCLs ho ysgol ong ng operators
Beh place opt or ig Ce Kf
ema hotest= Bat te block fe used Y Ror sorting those
ee Soe ee th lich ex ception aan Scout
Beart thls block fs ured Sr hemdbiag the ——
2 ception occurs fn tau black 2 cleelecteema
so stdlead= oa ae Au)
4) simole “ oy
SI) hat ement in ia
dt exeicite he statement if the cou d2!°c naesett Scan ee)
* Lie £4 2Bo000t
Ber aon
ed Ry Hadi” DAC
FAP ten tna ded ett he J
oe n= int input. Enter a9.48t " rss La
Ne = nt Cnput (6 fiter no, ond
x —large =n,
| “aa ae lays) 2 San
te EiGungl dni 0
=P lege ai Wet ah:
GaGa, ci fie a ").
He_= nt (input ( Enten.or4 oat)
iE n> cea Bai
Oh)
pri (a nc Mb. 1522? laroe
elses.
lara
puta ye
iss" large)PAGE NO.
ty AP to calculate income tax. IF income >
pill be Box if { income is bles Stak
207: and 2 tex Income f ran
| 9¢ = Tt (input (“ Enter income +”
Pa} lonanoet
ee = ee
etonsish (0) esas
if ASoon0 <% a
Y= %* Sa/ioo Z
s ‘pint (# tran is: ociss”, y)
Bias it ne 2 25 op Got
JES loo
eo (SAaxis 9° tory
Tink input. ae Se
ho = Ant Crnput (4 Enter no, ond >? oN
Larae =n
bE ¢ oo 1s)
= = : :
Print, pie ae is & ? slarge,).
-OR_
A= tat Cinput (eneter 48* no 22)
Mo = Wt Cuput ( Enten 0.278 no: 2)
- HO, >Ns ¢
large = Ay
“ks Clargest No. ise” ,-lavge i)
else 5
Be _nveoee=aee
He & larges gesees"3 GAR check cohather
not.
_____alghabek = cbr input (Enter
“So o\Dy a coe ee oe ” io SLi? Sallie nen iC tome a
_{ sarint (eae ix:a doinel?)
99
__ 3 _ IAP 4p pecdormn. — i
Q= int (input (enter T# po.?)): Jost
| b= ix Ginga (4 ter 2" yo:”))
ert. u 3 bir t/n(ayM Af /nU) side"
22 =O:
Drink ( No. fs even
PRE Fie Godd”)
EF nomd 1
else:Prink (* no is ve")
ile pink ( No is zero”)
state whether “it solfld L2qutol or gas
| tenng. = A Float (input ( Custer tempera
temp > ino.
a AW
tint “686 Water is th. gaxeo 13 State
ee elf eae on et
CD —_pniint C8 Wroker'is Yn soltd clote!)
gett Coater fs Fn IPgufd Shade)
Scallene or Tsosceles 2) $e
Sq = {nk Ctnput (8 eter side 4 py oii)
21S 9 15 inte Cin puck CE Enter stole
a Sx = aS we
ee | CE oc - So Soe a ji ,
aa | Print Egypt later g (ourg De?
ele Si= ob S,:
a * 9 pring Cece: sceQer Ldongle 2)
eS Oe tn S88
‘i a Hiangbe a,
ieee ne
Tapa Brio ae Land prlic the ype 01 A= eg ulaeee aN
PE Bach d Sgectt eee
a= On = s
print (val of "2
print de (“ aborting | 11”) —
atti ebb uF pe ©
Sf delka2O ®
vont 45 (b+ math! §48
smoot 22 ( _leop_provides else clause uth loop ofbo ‘which alla
ee Rxeced e the terminates rnor vn bay Bases
is i : [Kal lb abad”, Li knoll) 4 Varcanaal™ eae pi Ee a
al Paes: O nacthura, “ meerut??)
2 a Hin putt (U% Encken. ctu to seardill) a
for’ ety ramess To
| Perec
aA break nit ey |
eet | prick ( city fund ») we
a git (“GN Gud?) La Sa
ee Outout 2 = ‘7
_+|—__—_ yeranagt——————
Es Brio. iby ip aoneatd hea
Cy douncl ___ ao
akc fies will a Tike. ‘
mee below iP ._______|
Name_< [“allahabad”, “lucknow”, “varanasi”, “kan pi el
—___|_ doy _= fimput (# Erte dy asear) a
pe 2 if c= = cys
point (ety found”)
Weal
else s
print C§ pot. Found?)(estar vo.”))
Bitoanct Cou): .
U
gu cbts ote
Rein Com S91 = bb)SE S¥dng ioe Type 6
=? All sting python fs 0 sequence ese oP unis
—___Unicode supports every _ characte
___ => Following ore all feaat slings.’
__& CEnprisGe Higa! pete0,20,80, Ricroaiee = -
a tet "ot, Hem
2oRao04, 1-4")
|
he
ag
| >> Pomily = L" mom" ,™ TE sic" Br”
| _3>> oink (fail) z
cB | {’Mom',! Dad’, Bk ho
| > Tormmy" stn familly
TE Outputs ufillbe RDsow
—“Tugle. Dato. ype Bio
TA spt ore those, Vist. Pas connot_ ee aes.
| Wales Ore clefired fnside Parenth ests and
sss ERE (Can ee
es = Blite——Crichset * Crae See
ui > pxink (student) ma
: eee Q1.5
—__—_j— "Wwe, paler Dickimmary ‘
2 \ialue pairs. ,
, a ; : curly, =a