Python Programming full notes for b.tech & diploma students
The document provides an overview of Python programming, including its history, syntax, and data types. It covers various operators, including arithmetic, logical, and membership operators, as well as mutable and immutable data types. Additionally, it discusses control structures such as conditional statements and loops, along with examples of their usage in Python code.
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
0 ratings0% found this document useful (0 votes)
12 views52 pages
Python Programming full notes for b.tech & diploma students
The document provides an overview of Python programming, including its history, syntax, and data types. It covers various operators, including arithmetic, logical, and membership operators, as well as mutable and immutable data types. Additionally, it discusses control structures such as conditional statements and loops, along with examples of their usage in Python code.
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
You are on page 1/ 52
P|
= ob Sbodveion» variables ond 7
Dala 2 ype Sees
— se dnlrodclin
= Python is inlorpreled ’, +. te
high - level eaiage ———— —_ =
=> 4s open Ate. aL ‘en .
[Ss Veil appa
Lwery agy ‘ss earn 20: Use.
;
Dilan is a tase Senslie —pnganaing —
2 Tanguagé:
bX a is used to denelop “system
2p. Gu_, websile 2 pei
we (g Can easily —Salegaad gi pr
(COBRA and Tava
—?. i thon ha _an___exlension called a.
‘Hlislary Zo} Oylhan + sa
° Pulhon vac 4alraduced by. “Guide Van
Rossum" in 1980s02
og
ge =i gh ae My 14] ts ee liege,
, he» C canbe combined saith another nguage.
shel hy nan WY =
> hy “i is] else ins Pf | (0 is poebbens =
th i ian Den laste —Drgaing Tag 9 > cele — Sere waking ath Python, a
Sree download on python ove Kile J HC. 4s lo__tol .
T
iG te Grose ballo raning, he path 16 ge} tn the —douttenmen
4 , nage (utork tr ) — ‘hae Phy — Copal —prapris t_§
El pins ‘ a page
fein Id — So) Tsien igh elie an ea er > Dap
Pandas ee ——_|Mianced _Syslemn aly vironment VaptobleoF
___ ras
asic Syndax Ka
= car Masiable 7
: Fag lol a At <> |e —Synlax a ae pa ing BS =
= _ . G Obs
——— Fi Se iytan ead Chek Ok ok oS ailen
s was__deiged to be ahhh
it
|
1
ae
iy
ible- |
priok a+b)
Asia He
clicking
/
olp = 30
Pera
q¢ on . :
Sle.S do PATH
Add? ia Doser bal =
o id
Vnitable ig a name is used slo
A
Waiter.
pS tel on__4h Chedkdx al
Store the Valu
ee
ae aa
ad teal aay watk
Pilon —vaidZ vis —aleaKnauan as
Salter ate. iKed- edo hold yalue.eee
| Dperalors in Python
a
pe of sable
~
bt
wt
ue
i
1
iy
ae LD lh i ee OG
3. she ee pt 2a
satya aol perales.
value or a Vawiable
ie Vontable site must Sloe} toith aol: .
5 eta s_aniba con > énly — Conlin __ Z ; a
laa da tndnon lala leg", alt da parfm—
= wl ZL 7 pin fay ye jan utile 40" 2 20" dre” “operands.
“ex /sunelistion / <=
‘Types a} —Operalors_“in 2ythan
enclased tn.
le _names__ava_nel
TF
Duthon Langu
ie | Acilhmalic—Oferalar _
Assign ment ~ Dperaar
iit slors.
Logical i ; -oo
ao
=o pas
melic_—_Onesas
ee
tp
Tope Name
Print ty)
x + | Addition
j= Jubhacion
| Mullpleslon P33
print ON),
/ Avision PV
print lx/y)
peaked nt ted a tp
[Pikes [#3
Te ate cher TRue or false |
secatlag tothe Condi
Protl¥Ly)
2 5
Print (HV)
i
Phebe tee pp
*
x
ore - /
4
wot
i
Operators’ one “used to aaxi
snlist da atale
BMS
Zrample
mel olp
ys2o fe
Drind [r >y)
| tate + Olp
y=20 ia
Print [or a
a= lo ie
Y= 20 [eT
print Lx ==y)Opetalor Name ramp
OF ical:_OR Heer
(tive if either F
of opetands !=Io or x ecy)
| is_ true).
fren :
not ical__No dle__.
rse_the a ed
result) (not [or = \o)) :
Members ip Operators :-
» | Membership — Ope ie “I bs
1 heather im Pi i te mH = , oa
in. a. ea uence
Operalor Name trample
Lf She Sequence| print ("H" in Jack)
| bith * specified}... Op»
value_is présent| i Li
notin fal ie Le 6D 30.40]
log! sequences. print
ect Jalue ale
fe "ies Le ]
In Relurns_Tiue | Jack 4 =" oO”[bint).
\a tales binary #o|
y given ‘number
1S
—Operalor “pome: |. Example
| oR J arslg OP
on | yeig Tio poet]
| {pu “Lo
—[} sche En Gcusto [xe ole
parador— bese i, ai r a iB
Fes, “ue if the alo a ais s 2
a oersnds are velo Et}
a ‘lencal pein (ar ie r=)
= (ois ook Vue if dhe lo se ae itp
Jedd
ada lype is divided —
a a filha dale ype
i (lable Cchangable)
4s_|Smmclable(nion- chang3ble)——
Mutable: Hall delahpes< 4h data dy
tis sla and _
ra nls —_affer inifialiyation.
tg: list” diclionary —hyle amnay .Selak4
hh bp et if rhpes ef ca jo
aa ilps — —_|
— le = len Fal ada —|
a dup
ee:
pial dat
a Xone daa sypeg
{> Tlomaric dela Iygee —Slores numeric vibe |
> Numbers will never be in double or Sogle
ges ahs be trllen dilly =
‘Bien pele Tepe] tee dal =
2. lee tg “isa ae eglie
pasiltve pr gem.
al 5
ae op = :
ee
|
Be |\y
~ andy —denale the
xn and. —imaginery —parlsxespectivey.
Tranpke = ———
2) tf ae I49i olp*: ss
pnt la) [zi [_______—
byt as 14-23 :
: prink Liga dype”., Aypeta) |= 7
y ‘ol’
beading Paint “lumbers ‘A —flnal isa decimal - Z
, ab “ T125_is_a dype Iq 5 ——
pinta," ia 2 dype", Jype tal) :
— | Dickey _ =e a slee
fe dehala ae
| [as is_a_Ipe by | f= Tease name’ 2 Pylan min
i te ee y B= Fcmurse name’ Rylan’, Course: dural’.
z ti ie 5 a shh Bay ——] “omanthe ‘eee’; Somat
—T dala
~ AY )it a
— ge
: 14 4p shore _smultiple value _in
= Sais tnardaed cao] Hens > : t ae
e
Ta smells end has urique clement. >,
Gove 1villen bebaven * $2” 4 Dla Sipps Theo lypes A dewente Tipe
oS
ree.
4
WAN
x [$1o,25.%0¥ Typle isl Badened Sanu nee of _ifeme
ee al
ase cenied by by
_Comnmag.
|ro - j Som 26 !
“| te delay ig “Aan
valve
a
> Lied Slicing. Creoles 2 news lish roa, ar.
|
ny Fey
os old__one.
pee ee i a diclenasy can 1 |
pee! pe hes int af — python ~ daly, dynlox-
a Balan Jor lie! slicing
ist Lolard_: Slop i Stride J.
- “ge Hickenasies — Ose ‘nowened fey.
lve__faut ae
jason — fo —taplenenlod anil
gona cortel oo tak
ek oN “Hashes.
TE sl lidag = ——
7 [hing te aha used sh moog
tek Jatin i ddeak gale
a_i}
Ais els aha aga lek
a ‘n_list_,tish slicing te Used
SS be Bleing oo used io. lic)
lic’ 4 ig /
ie she
a uator_all _ *
is 2h opeity J where to nan bats,
“oL
ear et sl icing andoT
hi
Cope |
gig — s—t —_
endo —|—*
uy dopil icale
Ta fps | All
—— Fale hoa lid |
Mola |
a yaad deed ideal Ty
ee
-—~Ty
Pa
| dbaabl
“@unordted dolerval_| User 2
ale_members.
= Sie ba
Cala
Jot ()
i with Single
Sieg sath y
aes ee em =—_~_j__tyf
atta! Cela")
a ‘ll ala aN 2 thing | Was
ane _ only [elie hig | {—inl. af ~" lish tol, duple fut
2 Hess | not ladda
. ue ee La 57 30
——forol_atiructures ae _
hae Te
= Tiastels 4 “Gece in —pyho ———__—_—_ =
which Controle dh
Code ox ution, __~ o
a= int (“Enter the vale _:-"))
gtk? ==0_b Condi ifional_ ss -
ACen. fo as 3p
ae ar —an_—_erption— i
is__dtue—-_Jalse >, and
peat bal the
ae Bla i ze
le
a ; petak (2. "odd tumben") = .
op — ‘
Tl ee = :
_ Fat Acclnalit 4 , ~ 1
EE | ea -
— a ln
- 7 eibidaealla
jy Le vel| 3
L : me 3s
Thehsle 3] —Stalement —
int Sok Lingo Menler ah humber I Program 40 o_illushrade. af alent a
|. 3] Use se top eeaef oi_ti
iod(" number vi louerpstil an
inp
[9] ser — Snput_‘h 2 2220.
—prind_L * nimbet ig” even") —___.
| [User ‘opul = = in
| else:
_ ~ primer 180d") -
ap :
Late - ee ee eerie
“ =A shlemen! iil only .
aes eo pine >. a
puoher
[hie slaleaeal el ae j
Cone ansuar— 8 -shoays there)
inti” bhok SS
| Bho oxen jf Sekeift ia = te
[aa plbelesl pela al
the —Jirst ae ise
lad ape
Gody of else - at— I [Progam —t0
at
Nesled fs — _
‘fin —if elif “eee: olalem “inside anolher —
if else Slelonen! “. Called___nealing.
illustra le Hesled 9 Steel
| samo illus
| age = int Cinpud (*enler your age J) S|
; ij_age < 18 ¢ ‘ is:
ca eg ae Pe
= paottl' you are wo eld Jo aatry]
2 iti ai a apa i ___
|
e a dep —e [ange in Pyban 2
=
Tine duneljon hich
Raia one “pedofed jel
maT als ynum bers.
rot__mmore_ than one. Tyie a
| “delne Keyan
efine
"Vangel )? is. Used toq
i
a engel tera Slop Sep]
: —_——= a.
Talis — Alea
gr igased appeal — 2 gro —
TT Tivaneers Used —inRangel)
= ‘nsleucliong ——molfiple mes _—__———
i ev ako Hoja as —_leepiag lene! -
ase peliliv - glalements. si
hee fy = ie all ~ oS
3123) ye
a lel ah — hi
Pig sent
eatived
4 (ele slalenanls ove used Jo exenle 2 —
jo True.
SV Thore — one —fasteally —shon_dypeo :
Jor bop
Pibles gg
HE angele. ab Dae agp
x Drsmnples 2
=a oe sipala Back
Conlin ‘Slalemen! -
GP Mur é WF
Gul Mug
‘Ayolax ‘+
ns — Temenls— chan yee
nents tn_Dythan ——
your Code 18 exery:
hie j | Pass ts vnull Sparelion :
tases the Jas eset eel 5 used athena _slalemendt_ifa
_ Lveglted_—_-Syoleaically —buk user dan’2
a
Cette gies 20" lite paling ll Toop day ‘> — when His ~execuded_, nudhing happens:jg ised — Jor pass Sllengs Co : = = -
oo} thon __ ‘Basi. Programs —s——
NY Weil a__ptogram— 4o_cheek ushether_given
7 number __i¢_—_even 0 —
= ———~-
Tagan —o—eeeel_ilashale Pats Sbleme —=> pink toler — vae_aj 0°] —
t n= Jo} Cinpu :
-T ox § in yenge [402 a | if p22 220% zl
a if liee3): : prial_t Even Number’)
pass. jl ne en 4 *
print lod Number")
perin}_[-value Liz", i)
5
odd -Nucnhes
E sata =
nesled —_conditiane Potent
if ack :
fa (a ig lec than hb")
+— | else~ Ender _yoe Mat. $$$
45
| Grad
‘Pass
_ - ii
ila shea = tl eat ed pal
a [a is-g akee—Hha bs = ~ _
o- 8 r mn i " 2. J
93. WAS WAP dsay— he —vvesull Such aa [hae ink lingo DD)
7 — is econ Class. pass gum = D—
| fea te 3 s OD
7 wk Pavers
sores opus js t44
fumes. 7 — ee : print (gum te: Sum)
oe arate a
aS ct past Gade isl 5} i : 2 ~
=a eli. _|Olp = 8
ess i LL ade fed can ” :
— lif fo fale: the alse i o
pol tele as) =
~ else + om is +16
ito le ica obi] ") Averagé. is 8
——_l -So
Soa umber
=a yh ah
a
ssing__uthle— p
wh
t
STE eae a"
aa pl ob fo valve of SN I alee: 7a dl
= iE The _guare Feble is. ae_ given bela..3 1 «j5 —
= =D r
— fod 4,425) .
Pg so
per a “ile Taps fer th even —
haber“ beliseen 4 Vo a
ae te Ver
gall" foler fe ake: of ook | I *Filna ci Beene fbn
nie ink Cinp() 4 | bento Ma te I
424 |re S 5.
: yc appe cand_)
prio} {*Eoler he mark in_Comprdercfcienco+)
iy
_| ~ 40. pr _markst< doo marks S<40) “
ea ed eee z -
se — Taig Poet otll Ts Hplig og
8 | elds —je_touset_marks_a os pri i fe
mia ex wecull . Bidet ie pansi Tay aug > 2 g)e tes ses
he_cores_matks gl it anf Tat
+4 priol lo Grade Third Oivision")
print ("Pai")— ou — _
prind tron "5 =
elses om wing
print nvm.” ‘ig da 20
Ender ame number
¢ pean oan aunsitong number
To dind the Sum_—af 4 20 40. —
numbers.
soe py, i ji
fot (" fnler the Valve of 0.
Poe in ip)
_$um_= 0
Jor__i_in say. aegis
Sur = Summ +1
prink_" the Aum “Facts
olp 2
S
s ERRGNAS ea
—| sobliplicatian de Sf
\wrile - a pega to disply “The56
=> | prin! I fnler—nvmber_Jor ifs inolh peli Tis,
nz int finpul OD
E (4,44):
Im ail tris, 4 itn)
y ye
lp —
Ener nuinber_jor_ils woliplcalin fable ——
| 6. 3 nt
[Of
WAR Jo the — ber gen pane ig
ni pemne ad
“HE: User Can_ be valve
> pa (0 Enler. He number"). =
- of N
DIDNIYSGISOSUD
Enter value
2
“the Som —i8
or nol “ _
by beybeord
=) PAPE PP Y
TT vue = ian x Nig pola pine mn)
44 Shale + Ald pwn
WAP to pa
SIN Series
Foie Dene py
fo 1" fale Value cn
—n= fot linpu ())
|
Ph in —sage- feast
Sum: Sum + 4 ——
ee
= ‘ oe jot Pum, isa pr ime_numnber") —
eles
print Neti pie% 4
Dbuchiots ,TModdles ced jo Glue tf
” Rasa jit ag
wes, ws Mote
fat (i toh:
VV VY VY
aA
6, presi ~
aa ef eek pone (garonelerss +
ah 1x "dala ets
Fyfe 2) —telurn_expression
oe tteahe. a in
the, Yes card et ois a.
EaMeg patna
penal = cma
thee te Sess fa
iC x al le aaa 23
— eel, std 7a oe -
Suan: suse o__one__en:
ei he al t ‘
t tr 1 oe my = bad, | ae heal ee i es “ral jel 2] — =
een Can
oar}
ye be 5 ree
adealicns ate _.not "pi ith _
tid“ goal-_-gve. aE Expeciel __
ii fe Tega ade ofthe pA hypar,
ee =
ie,Pris : tT F giu. ler = all i ae
& ——a emond_ts-US il ile H fall do the tunel ;
=i Bln ca fifo lll” aT Tap ———
— ana pyr a op=
a 2 feel Seal 4s a
alia ncson—iS. See
Pe |
Ze t 4 Ole= .
aa . pa name) ; f goad evening Ankit. Kumar _____
aes unctian vane Ca Dy
suds z a : feyted 2+ fa_hisorder_is al permanent
hes og va 3? = Neral age = ‘ol j —
ed jiskanglls &% al —— ta tel et
f ae boa Zelinalign posal aguas — -
hike Hoto_are_you") Puce lt
ei ike Sian Dean a re :