0 ratings0% found this document useful (0 votes) 80 views73 pagesPython Handwritten Notes 1701013067
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
classmate
if = Guido yor Rossum
Syntox i> - 19a1-
inaport pandas as pd-
| PADGA PrN [GOge. applic xtions -! _
AMAIA, BAKING Machine leaning,
| Basic voulables:
Data — collection of the pacts.
Ex! My narnne js poornro »
How to stoae the dato
" Pooana! —> string
| S56 Tega
Tane|folse —> Booleaw
| variables.
DAtA VAIUES corre Stored internponnry >
StoAmGe Spaces called Variables:
rore atbh = 30 -.~ ws 32 04
a-b =-IO0 multiple oprahons: !
20= 6
Il. akb 2200 onvorlables
alo =
3) vecisiorn Making statements:
| 82 ig else
HIS AW ining : ‘ <4 gO 0uUF and Play
_Sit Instde
iP else
MOUKS > 10! 245K _ give pracice test
Get ice -aeanw. « :
ip ~~ - else pseudo code
ig(Conditi on) £
Statements t be execrted?[wor ny oe
| ave Used fo sepeot AtASK none Himes.
While, Repeat; Erch«
_| While loop pseudo code _
|_ While (TRUE)S,
Keep exerinting, statements
| a8
FPanctions in PAD g Lnanniin gy 3
Function is Ablock fcode Which perpoums
_aspediFictask:
OOP concepts.
| Toe suMounded withthe. pejects
Mobile, inptop, bag bike, dog, cat
Object have
| Paopeaty
Behoaviow
class is @ template for Aeo) Weald entities.
ees
paopeties Behaviour
ecole al __ *AMake calls
x cost KWe cantext
*KBEhav 10 WE * Watch video
%® Play games
"CODING BUGS | NOTES GALLERY| Object
TLhas o Specipic template : _
x objects ore Specific Instances SF ACIASS
Phone WWld be the Jass 4x
specigic instances Would be the objects
Baands oF phone Apple 4075) Sie
SAMSUNG
Nokios
google. pixel
Tesi
Appleis the brand sf phone which iS object
op bIW -objects 4) |e! Or t
All having. Pack
DIFFRENE valnes POA PASPAAHES
DIFPRMent valnes For Behaviour >
5)
AIQoAltamic OAPPAVACK fo SWIVE Piablenr +
Step by step apprgachy ViAGOAG aay
{0 Solve > problem is Known AS* Algo aitan
input —— Steps to be
followed
ow putHumber ¢
i fesso, / ( Nunsber
Tp aAWrAben Lhe odd i :
i
|| EG gral 4
| Wadhivad t.3-—Q0ls vee: betAcep aati aaa
LNA QOL AL $a ON Seth A
" Sie a pageiaies 6 ae = _sa
Introductory to pythow:
Fraeeand openSoUce
Ks preeto download and to 4
Patho mae-coding init
7
a \\ ¥WE COV AUK OWL Code
Trany spine 0S platpoa
\ igitis windows, MAC, LINUX
TT Sottect oriented
* BY using trrobjech We
‘ car get Solmtign por Hit PAD
frrge Standard libro,
THPAOVIdeS MUCH. More
§AQKIES Which, we Le
inneed
DDE - Prteqrated pev OPrnent Envidonment
| Pathorn Pacha, Ano conda,
Webpage pishib
as
7% ~|
=)
I
i
I
| Painst(" This is pooanat)
Trtao to Jupyitr notebook +
kernel Cxecintes tre Programe:
Ts ispooanoy
=
Variables: , HE tom
OX ="Pooangn! 5 *
Voninbles and Datov-types in python» os =
|
i]
w ‘oa is~voriable —
— Pootnow
HA =Nchandanr" gas
w Le
> chandaw DALE
A=" Gowda’
| iw 5g So
> Gowda
Datn types im python
every Vooble is associated Wit thedatw
dD tnteges (int) Tnrege valnes USS iga
1,243, 4, S; 100, 1000,229
Floatx | a) = 100
Lal
| 3 100
“type (a)
Sixt
i
x) AL = 34
al iiegid BALE Balljod
= By eypelav
type (3.!4) — Float i* Se
J Hoat
#|| al = Tne k au
al
J Tune ‘ o> eae
+ype(a)
=> Bool
# | Al =" PooINnall
al
J !Pooann!
+4pelar)
2 Ste
x Complex Nurnba-
Botn Real and a Fr
QAl= 6ta5 SEAN PE
al| classmate
|| Ratt metic opi ntos
ReIAHOWA| operrntor
logical openctos. — « % ¢
i | We can prporw vartous types oF Ope
| bg wsing above mentioned operators.
Aaithmeric apernpor A
A=lo
b=20
Axritamehe on Mathematic operations
(4, = 7 *1)
Atb —> 30(10+20)
a—6 —> -0(10-20) | bas
b-a —>_10 (20-10)
eb 3 200 (10%20)_
a8 —) 6:5 (10/20) > We Showld se fpounond slash
Relational Ea
| 0>b —>False, b7a —> Take (20910)
ta
a logicaloperator "a
— Bitwise parator "8", wy
_@ And opehntor
_a=tane (1)
b=False (0) i
Lagb — False whartt+ne and oparctor
bAn —? False weger A+AAe VAlAS on
bab — False When batrtheoparannd SO
AAA SF TAME _ Paine (yp shoal
| 0% operctor ¢
Trwiligive Wsethetare Aesult When 3 |
| eltnen op the operands is tare 0A boty oF the
opehands are tne a q
We will gera False AeSWIt wWeket tre |
OD OPUATO only Wherv both the operands
ene false a “i
A= Tue (1)
b= False (0) ; ea
ft.
on
Alb —> Tune (either one valve. having
bla— Tawe (ais Huey Ol) shag =
AlA— Tne (both the operands AER
bib —> Faise =classmate.
——_ +
__ CO), Tokens in python
a —
|_Srneliest Mensing Ful Con~ponert in ov proqaarny,
= a
_|| Keywordsivor) suite set
~__ | eaentpiens
|| Literals
| operators
QO) Keywoads a
— me Special aeseaved woads tz
os || TRI give Menningewl Dnfoanvextion for the
Compiler or Trteaprertenr. 3 y
i False class _ Finally is Return
None Confhnne For _ lambda TAY
. ar der Pion | Nonloca |! While
_ and del Globo} Not . Wi,
AS elif pats Om 6 gield
@)| tdentigiens. zs
| KE NOMES Wsed For Voniables, puncHons = -
q or objects
Rules —
: No Specin' character except — (Identifies)
TderntFies oue case Sensitive.
Fast letter Cannot be adigit
E Poor iS iis DcentiFite
ce | _Poorno is being rdentified by Wis name
CODING BUGS | NOTES GALLERY@)| Python literals
= Constants in pythory (peneh ches
Al = "Pooanc! brs a SHIng liternod x
Latisavoriable :
A= 123 —D Numaic fitrant <
A= TAAL —> Boolean ji HAL %
Staings in python
TP ME Seynence OF CharncraAs eEnclos
Within Single quotes('!), dowble ave Gs
ox MEIES qwotes (Mi HID
"Hello Woald!
" This iscpoorna" ..
Tan Going to KEADIA tomaAnoW Mt
b] =!Hello woald'
bI— THelio Word! «
bl =" This ts pooANK"
bi=> | This is poorno
bI= "This iso muitiline.
StAing
Ky)classmate
“Extancling+he Drdividual CHORACHAS) de
——s é
_Trdexing in pyrhor SHAN With 0, Rob ln
012.3456 489 012M Is 4
_My- Stating = "My — name — IS — P00 z
AE ASH B=(2 nome sis ei
Now T want poornow
my-staing (1114) >! Pooanay
ae St
J* 290200"
reno sting) lHReplacting | A SUBSHUAG
my sting waeplace ("ya")
—'ma name is poorwre. i
NUrmnb er of occ uweirences oF SWbSTLING-
New Staring = "hello Hello hello World"
hew-~ string, count (“helio'D
a 5 Se
Finding the Index of subshtin g, ViilN 21 ARS
S\= “TWis is Pooarna!
St Find (" ie y
— B \ : te
SpUHINg a sting.
Fawt =" Lifee applies; man ANGO eS) banano.
Chemies"! i
Patt. split(', ") eC
firiice apples’ ‘Mangoes';"banonc!,! A@ Tuples in python aa
classmate,
——_>
) Sote
(7 Page
ee
Dortov “Stawmctmes inpytnorn
Uist Hi
DicHornony _
set
[Tuple | .
4s ar oadered col \ecHary oF elements
enclosed withtry ()
* Twples are Innmutable
a} ONCE You cAaeate the Maple, $4 OUAE BARDEN
| the vaine inside te taple ¢
* Heterogenous mixtwe of diffuent elements:
HETuple = ; ©
tpl = (100/"b', Tawe, "cl, False) -
tarp] —> (100, Ie!) TAne, 'C) False)
| type (bup)— > faple: ‘ y
Extanct Individual elements ‘ aml
+upilo] 100
tupili)—'b'
tupif-iJ> False { chercitiallinds
apiliig]— tb! ave
4api[2] —= " hello”
We will gerorort haple" object doesnot
SUpPOAb ten assignment ,Finding lengt~ of Txple
fupl = (100, "bY, Tare, WC, False)
len(typ) > S ‘re
Concotencting Faples
a tpi =i2is)) =
tup2 = (4516)
I tupl+ fap 2
(1213, 4 51 6)
Repeating Twple elements
tpl = (!Pooana'!;300)
tapixd
= (Poorna', 300, 'Pooana, 300,! PooANa!, 300) |
Reapecting and Concarenahing
tpl =(' Pooana', 3005
HapintGyis76)>"snaT lala
Auplt3 + tupr : os)
— ('Poornw,300,'Pooanc; 300,'Péoano! 300
Tupie Funchons.
Minimum value
I apl=(12134,5)
min (typi
=! VATclassmate.
—@. ies in Super
Ist is an ordered collection of elements
is
| _endosed within D3)
|__# lists ane mutable
We Coradd, Snbract, multiply. values
__insidetne list.
LUE CL "Poona, 3:14, Trane, 5495)
| ee Sst th
* leanunee Individual elements
|
(ub sai. ;
“| ulitu) ['pooane! 3.14, Tare)
* Modifying alist
Changing the element a oth index
all lal. 2 Mb 3,"cr]
| SieeenBios) = 7aL00
Uae,
| RRR OS AY 2 MES es
Appending anew element
=e fiat 25 lb", 3ed)
. | UU. append ("pornos
c a u '
ol SS [1la!, 2,'b', 3,'c! 'Pooma)
+ d | Popping the last element
eS UL tay 2, "4 3,0")
U. pop)
ul
Sigiees 2)Reveastrg elements
[= fitay aitby see
uy. aevase()
u —
[tet ib) 21 Pe digit
Ce
Trsecting element ora specified
L=L ital) 2M" eae
Uninserct (1, "pooanat)
3 C1 lpooana, 'at, 2,'b' acd
Sorting alist
w=" Mango", reany" "banana'',,
Lysoat () a i
concatenari 9 lis ts ,
u=C1 239 oi
‘ he
ef NAMA", fe) Vé =e
Y+L2
fates aye’
2 3 AL, bY, kel one
Repeating elements:
U=Liia", tured
LAS
> le, Bue,
In -
VIO DUR, | Tat,_&| Dictionary Inpythor | rac genta)
|| iS an wnordered collection. oF aes valine
| paias enclosed with So
|x Dichonoay is mutable ‘ ' lads
| Keng PATA A 5 VAlne ee
paurit =flapple”; So,"bananali3o "Aang e!'4o,"peoch": 10g
_| Rape(panit) dict
* EXHANCHING keys
paurit =flopple!iSD,lleananall 30, sonalegentaeemie 60g
FAW vkeygs ( ) c
=
dict-keys (['apple!, oannge banana’ qnowved))
KEtAoctngvalues : : ia
parit: Sopple"s $0, "bonona': 30 Nonringe': YO ,Nauowa" 603
| fanit.valnes() io,
=>
dict values ( (50,30, 40,60])
Purit. items
I> a! 5 ‘
dict-item S(Capple'S0)( bananal3), (orange!,up)) ('Guave',60)))Adding anew element
—-—
gautt = apple! 10, Wonange'!!20, "BANANA! ‘305
FaultL mango} =So : =
Exnit —
) oa
LlApple'No/'oramnge':20,' Bannan 130)’ MAngol:
Changing an existing element
pauls "Applets 10 , VoAmnge" 120%
pauit [Apple] =100
Puit—
2 'Apple!: 0, aa ge!t 202 1a ix
Fauit! =f" Apple's 10, orange": 208
PAU? = PNchomy": 30 "Banana"! Yo =
PAWUits update (panit2)
Pot) a?
PIApple'i!0 , !oAdnge" 20, chery! 30 ,'Bananaltl
Popping Anelement (Removing )
paurit =f "Appletito "oAmNge": 20, "Banca! } 3D
faut: pop(ornnge")
fiwit — >
LT Apple! (0) ‘Banana! 3p.| set ts an wnoadered and unindexed
Set In pythow
>
colilectiory oF clememts elclosed Witt ia
& pupiicares aie not allowed in set
S1 = £1 !Pooana!," Pooana', eT
Elias. _
31, "Pooana
Wie Cor see, duplicates are not allowed in set
Set operations:
See
x Adding a new element
S1= Zl", TAUe, 2," oN, Faise %
Sladd(" Hello")
S\
LUZ IFAISE/ Heo IAL tere
2 Theis ho prOPER Sequence inset So
+he Indexing isnot possible insets,
* Updating Multiple elements
{ff
Si= ZI ta", TAME, 2,"b") False
Stiapdate (C 10,20 130)
Ss)
£110, 220,30, False, lo! vos
® REHGD VINE an elementSet prrnctfons: VOTE 7 oni Po snd ated wap
| Union and DytersecHar So aysud ibe Bl ig
* Wor a
SNe $2133 sas Si ;
S229 haw MN tery Basically Gncrtennting.
Siswnion(St) —> Wo Sets:
71213, la! Ibe! 3 Su Bis |
* Dntersection & xi
SIE $1,231 y Se Rnade STyopimd ont Remco neRnee
S2235,6,4/8,9% elements behween two
Sirintersection (S2). = Pets.e ci 2 nue
isc}
ge
tania Wasthund sap SA ot trely Guy|e Statement
ig
its ANning
Sitinside |
else
ao outand pli
I @ =10
b=20
ig arb;
Paint (tovis qreatrthanb") z : cul
pipe an oat BES:
PAint ("bis greater than oar)
if oobs EF pa
PAInt{ Ais greater tron b")
elsieny
PAIne("ats not greet tron b")
Ran
ais hot grenterthan b
elseif 3 We will welt wher
WE Want to check ype mUltiple Sto| c=30 Cou
| ip(@rbandg vo): a
paint ("ais thegueatest'D § j
lelig (boa 8 b>C)! aa
paint ("'b is the greatest")
[elses F 2 cde eee
paint (" cis greatest ") last jb at
TBA, Te isthe grentese OOltL Ns Gis
Now Can Seehow canwe Weis |
Conditional sintemen's with, Ust, Tuple ee dichonawy,
tapl=(/243/4) (Git MPD aa
Lip zin top:
PAint(" 2is present in tuple) ° | = ae
BAY zis present in tuple a hale
3) tapl= (1213/4) , SDs hl ght oa
Life intupl*
paint (“6is present inteple)
cise
paint('éis not present intaple")
Bur y ¢ is not present intupleAS ed
r ig uCs=2- aoe
i uf'J=upj+i0°
u—> Ly, 102 3,45
i *) U =[2134.5)
ig uCyj==!0%
ie ufJ= uf ]+ioo
elses
a] uly) = uLy) +500
ee) s[vt023/ 41508 J
Tp with dictionow
eld = Os HED 3y
te diC"bYJ ==2:
di[tb"] =di ["b*] +00
dl — flat, 'btndr, (o's BR| classmate
| 5 cae)
aan)
| LOOPING STATEMENTS ZN PYTHON:
_used to Aepeat a task multiple times,
—_@) wWhileloop= Ot
Hs he ad {ent while loop
| Syntox
while condition }
J | Execute Stattments
i}
«| f= a
TWhile TeI0; 4 =
l Paint i> é
| ea) pas
i -g—
a BS =
__|| NE2 scale > BER
While i<=lotos 9 2x5 =10
Be | paint(inv "RE" nxt oe 212,
| ie Dk =p
a : P 2x8 16
a wr g 2*9 218
¥ A “DX20= 40
- DRID=:
¥ a*) UU
= (123/92 t=07
while i slen(u):
utid= ulid +100
icitl
u—> Ciol, 102.103, 104,105 J
FoR LOOP
used £0 itewte over m perce
(tuple, list: dictionary)
Ga ia in Sequence
yc wbdy OF POA,
key word a d
t= (lope! "eanana'," orange
Fort inut -
Princ (i> : > Sita
ee tele
bananc
OKNAG —,
nested for loop
= [Norange e" "blue", "qseen!] -
5 EY aha VeRoiae ‘phone*]
For Tin:
for dinizi — 9 ”RNgE Book
4 palint (1)
- s blne book ~~
bs NE .Basic problems in pytnory
Soe
_@ check ever onrodd t
i Aun = int linput(! Ente anumbert’ "))
| ig (numa2) =o". VAD REM oInd ee
/ paint (num," is even") se Fids
[elses G x
PAINE (RUM, Mis odd).
—) Enteranumbui Si)
| Sis odd
9 ERR NAmb 8
gis evere
check positive pr|eqgahiv e@ on0
num = Floot(input (enter ANnUmber +
iFMUM 270 + ‘
paint ("positive num!)
elif HAM ==0: iG
PAiint (# Zero)
eee
] paint (tt Negative nuamb et)
— BHher Anum! 8
Positive nuUmbUw
ar mo}
Bro
— Entern numbeni—S
Negative nambe.Factorial opa number:
AWM = tte (Input (HER nwmberi 1)
factorlal =!
ip nann
Noamal Prncton P 2 HAG
| Lambda function ; OOS VS ee
Normal function Sgntax
dep punctionanamet o>) 8 6 96)
Execrte Statements
_ | Lambda gunction syntax
Lambda arguements | expaesstorv
@) dee helo os Hey Abana)
|___ PAint ("Hello woald")
| hellod)
= pello World ss 5 ©
_ie Gepjoddioe>:
: AeHAY K+10
eqn oad (10010) fis
x 20dee ever -odd(x): ¢ Ee 2
ig XK22202
paint (x,."is: Eve?
else?
Paint (x, "1s add")
J even_odd(s)
Sis odd
Lambda fianc Hons: (Fle AAP: Aveduce)
=
B= lambda kK: x#x*x
Paint(9()) i ws
343
MAIN functions of lonntoda opeawtions
3E lambda puncHans with (rites) TOES foie Panne!
Ga[ 5), 22.194. Sy 62, 4123/5361) 0
Final list =list (filtta(ianbdax ! (x%2 120) y| i)
paint (Final—list) IS
EXHACHING He a Wumbas.
[Si 314% +71 23) $3) 61 J =| PAInt (gina) ist)
|— — coh aed
(| Cio 14 G41 Lo8r2y, ISU, 46 146, 122)
aL
Ge [S112 9F1SU, 62 AH 23,43 61)
Finalist = list(map(lambda x1 x*2, 11)
* tambdoy withaeduce.
W=CS18 110, 20,50, 100)
Sum = reduce ((lanbda xy! x+y), Li)
| Paint (sum)
5| object oriented programming) =)
ee
| OOPs ine Pythow:
ees
we one suxromnded withoejects _
like (mobile japtopi bike, key) pein, dog: book)
classes i-
Class ISA termpinte for Aealwoald entities
- a class
| Atalbute|Propextes Behaviour|Methad.
oF
{|
“i Phone
| PAoperHes Behoviouww
q _* Colo * Make Cols
ll COS *AWatch videos
7 1 ABattery li pe as Play games
Classis AWsea defined datatype
+.
b tris adatahype Which we can
Create oy ourselvesobjects t= aq ees
objects one Specipic instances oF & gece L
ie bile) > SS Apples
wi! TSowrn _ipprent ; =
il class baands v E
objects SF freAS SGI Piast Classi snob
tenting a class phone
peed
class phone + : dReprencirg
wa __4eF fe als a
paint ("making phone call") /
dep play-game (self):
Paint ("playing ganne")
Root Pi = phone ()
Finvoring meineds tongh object +
NIESFORjECE y nowne of the: Method
| Making Prone call’
| pls Play Agomeria gahion!) s
(> Plaging gamers
Adding poarcametus to a class method
__class Phone *
I dee set-color(Selp, Color):
Selp. color = color
dep set- cost(selp, cost)?»
Sep. cost =C0st
def ‘Show colon (selp):
ACH Sele, Color
dep Show-cost(self):
ae Hun Sele, cost
dep Make—coli(selp): > aoa
paint (“Making phone call\)9 3.2
def Play-game(Sele)i
print ("playing game
pr= phone()
P2.Assign
Po. Set-Color (bine!)
| P2+ Set—Colost+(s00)
P2. Show—Colorl}—y bine!“creating o class with Constanctox -
class employee t s03
| deg —-init-- (selp name, 29¢-colaugoae a nny gender):
Init method acts 03 Constunctorr
wv
| SelBiname =nanve |
Selpage >AGes 2 abi an Sie
selp. SALA = Salm. ce
= Self: gendw= gender
def enrployee-detoils (selp):
Punt (Name op employee is | seipinanme)
+ PAINt (Ag eof employee isi" selpiage)
____ Palin (Wsalony of employee 15 SelprSoveng)
PAINE "Ged & oF employee is!) Self. gender)
= Erployee ("'pooana!"', 23, 100,000, Male) -
| Vinstontiating the "el object
| Elremploygee —details (2 Inoking ‘employee details"
Bacio ae
= Name of erployee IS poorna-
IL age sferrployee |S 23
Salary, of emrployee iS 100,000
gender of employee is Maleeee
iL_ class vehicles
| ee Selp. mileage =Mileage
ime. class cary denive.
| T With. Thheritance one ©
the paopeties op the arothel SASS +
deg _—init-—(serg mnillenge (Crst)2
Selp, Cost = Cost : vs
dep sShow-—detalls (selF)*
paint (tram avenicet)
paint (mileage op vehicle 1S" Sele mil
palint-(1cost of vehicle IS!) selps cost)
_VL=vehicle(Soo/s00) ! {
Vis Show — details CD
Zan ¢ i : Jicaues ;
Tom avehide aia
Milenge of Vehicle is 500
COS OR Vehicle 15 SOO > < oldawse ig“#F Geating the child class - tal gible va ve
class coartvehicle)? 3g Nn zig
dep Show —car(self.)s t
PAind("rawe acon). 5 a
_ | ct eca(290,1200) > Tobantioling dhe objec
__cheshow- details) fordNid class
| Tom avehicle {
mileage oF vehicle. 1s 200 a
cost o¢ vehicle is 1200
Ch Show cord) ae. TrvoKirg the cHlid
Tan a coe Class method V8 aeover -Aldtng init method: ©
| Class con(velnicle)s
dep ~-init-- (Sele raileag e, Cost /tgkes:
Supat). init =(mileage cost?
Uselpntyaesi= tyne’
SelpsAp = hp
def show-Car-detuilis (Selz)$ r
paint(’ Tow, ovcowl) A
PAIK ("Numb op hye s one", Selp. hyxes
paint (ivalue op hp is”, self Sp)
PiNvoKing -show-detail sO vA
method Fiorw ponent class
El = UA-(20112000 74, 300,)
Cis Show —details()
—
Tam a vehicle
Mileage op vehicle is 20
cost F Vehicle is 12000
Finvolding Show cordetails()
method from child class
Cli Show.cor~ details ()
—>
Torr A CAL
Number of tyies ove 4
valine of bp is 300“Types op Damitonce
ai Single Traheaitance
Muttiple Banenitanc® ok
1 MLL = ©
multi-level Dvrenitance 7
NS SS
| bgbrid prheritance
| Mwitiple Trhedtance. Hain
| The child innenits Prom Moke thon
| |PMENE CASS:
class parenti()i a “
def assign—siing one (sele.SH)4
- Selpistals sya
~(PosenFe
“dep Show-sking_one (self):
_ | Aer Sete ste
Class parent2()!
I def assign-sking—two (Self 5-2);
| Self iSAL =SHZD
def Show-shing hwo (Sele); (Potent class 2)
+ Aer selP, SHA
j
___ Class derived (Parent 1, parent 2);
| def assign-sking-Hice (Self, sk3)5
= Sel F1SK3 =SHZ
f ____ deP Show -SKing —tHee( Sele);
| Achww Sel p. SR3, sales
_ 2
child lass ©
creaking He Objector the
! | di, petved
dlrassign-sting-one('one') :
cll, assign - sKing -fwsd (itewo"D
dj, assign - shing-+see (IHrtec!)
Troviing method 5
ERS oHia nel.
SS tone!
dhishow —Sking Wa
— > ‘hwo!
dir show ~Siting-taeeO)
twee!Mutt -leve) raheitance
Wehave prent, ctAtid and
Qaandchild Relationship.
Powent 1B
Tthoaveboth tne propahes
of Child and the potent.
| Ponrent class
| class powent(): 7
I de F Assign name (Selpiname)i
I Selpinanye =hname
| dep Show-name (sele)i
| Athan Selfrnam e&
child class:
{| “Class child (Porent) +
| deg assign-age (selp, age);
Selpiage = age
dep show-age (Sele);
achuiry sel page
| Baad child class
| class qannd child (Gniid ds
| deg assign-gendu(self, genda)s =
Self. gendu = gender fa
deg show- qende (selp 1 7
ACH Sel P. namegle ch gaandchiid (>
| Ql assign name (Mpaana?
Ql. assign - age(2s)
Qrassign- gendrcimace”)
Trvoking class metnods ©
Gi Show —nam el)
—4 Pooranor
Gli Show -aq el)
= 7 mas :
dl. Show - genderty
i! — male-
fontinuation oF pytnon—
Eemragts
"__@6) ARI Tin Python «
| iPwe have int adoy, we should only hove
All the Value oF Sanne hgpe:
Int coho,
ip We have plont anny, We Showd only howe
Fock ossovy = eS om
innpoat May as or
OX,
(aD t-signed integer (-\to
Flom adrorginnport x T-unsigned integer
vals = osnom('T 4 (5,9, 81421)
PAint (vals>
PAINE (Vaiss bur FUKinfo())
— (addaess,size)
PAint(typecode >
i — He one Woaking With Integue
PAO o8K2y Inport *&
vals = asrong (105, 9-8, 4,2)
Vals: aeviuse ( >
paint (vals)
9 oe C7 [24 = 8, eg)
Vals= wo 05)9,-8,4, 2)
| Fort in aonge (5):
paint)
aS.
q
—8
i
2
When we dont Know the. Aminge
$0.21 iin Ange (len (vals):
paine( vals[ iJ)