The document provides an overview of Python programming, including its features, syntax, and data types. It covers basic concepts such as variables, modules, and operations, as well as how to install Python and use its package manager, pip. Additionally, it discusses input and output functions, type conversion, and operator precedence.
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)
11 views97 pages
Python Notes
The document provides an overview of Python programming, including its features, syntax, and data types. It covers basic concepts such as variables, modules, and operations, as well as how to install Python and use its package manager, pip. Additionally, it discusses input and output functions, type conversion, and operator precedence.
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
| Whet
ac 1) _a Simple tural _saay to__undendtane languoge
| wah fete feels Dt ke. eachsisg Simple Gags be
Thia pseudo Code _natune —of Python Make at
fay tn Lean anal ee
Con be ude! fos
# “
Abblicehions a
x ~-
- f. she pe —efAbblicetiows _memtioneel abave_
4 aS me stypes of opplicactbad[ita Pye i etabea da ste _enaly 10.5
but the meal waplementston Stusteal win “198.9 _
| ane it waa finally. _publishec! in_1931 (feb 2% 189
cee maugee jn vamed after BBC
re Asinatine ing Civeus", Gi Ve
Rossum —tuoxked thd? time in apa
Cowtrom Withunde & Tn formectita Collec! Amped:
Va disteibobed —obmarting —Aysctem.
Feotunes of Python __
Python (a Simmphe_cundl Gaby to _lecan_,attacl —
(oele is al no Uige(lahle: “Thene fox:
te Batnon language iA Brely avails and? ~Mee
Tee. L ted,
| an open _Sounce pe gremming language.
Dutnon language ah men expwevhive shan. sunitantl
ua mone —_umalenatunel
| canal
|| Peon Comenius Equally om ditfenewt platfor
Suh oh Windows blaux Unix and ractntear Sop pants iva ret pao sors an
asell cs object — ovienteat Paogramming.
at | Riytaon hap “—_ oo oe sohich
Proutder funchions —
sh ee aide” andetar
Can_be sanity inttalled by pythonoye
__[ralren qyou_click on the — button. _puthan Con
ke ye ___iweinMedt aight esftten pra the Set-up
‘et excusting the Sie fox (yout Plottorm 5
Just install it like + game | j
| Finst P
|| Lets Per a Vey Banat python prague. Create co _
ie __Callect ely. p Voiol_ paste ie (mele tohieh i
Sven. belnus. =
puintl Helle talontel ") eS
[ “ti point Jo fuechint iobich woe sill Sdudy Lecken_
| :le cecacion ae ie py ‘bile! en ing __ python
Da painted
| hello-py _eyncl will See
| an Hae. a
_ Modules : utes j
LA module jo_o file Conckciining, Code worsitient ly
| simeone elae uahich Cam impamtenl anal tuned
Lt eu __fomngpeam’
Pip : _
[pip is cthe__pocitege mmegen fier Pipthon You Com. ,
ue pip cto nikal ey tenable on youn Sy Acieut
Typea_of Moduler ,
Tene ane uta ay pe modules _in Python
a. | Build in Modules = Pre = Trstetledl in Pytnen
_ a. | Sctenmal_ttudules — Aled to Syslell_uaing pip 4
|Comments
Comments cine “used to _uawite ing he
Prague men does ash tant ae
he ton be tod eithon name, date. ef __Tiviti tine fomments = Lari tren using Comment”Wasiable ae
A Vaniable 1's ine fame que a memany location ti
A. Pagar, ee ae ee =
|e te sees eed
| A etioble he Gotten fo stone Valued
__oyll Gsora. ba Mom” C= 245%
toon en nol Ce the Variables Vroit Stone
——_____|_ neadective Sdota, +
_Tdentif tens = —i
fo identifiers fan clenates Yomiews ewtities Like
| Vantable type Svbvoutings, labels Functions packay,
inal So on =
fox example! si -
= | whene es ta cu ident Bun neo Vovigte
| Resend in Apion ane Knuth oA ke
jResen et epee Te{
Pata Types
eae dene one the lluaiing. date types A pylon
T
| Sat ——
|| Flocking paint nu
S| String pete
1 Bisaltat _
5} Now,
Q, ae hace seat echo me te deders tr fies,
Hine — af det eg ae
* debeeedh ds losing point numloeys ae
bE ae Fiaccling promde an epi by the puerene.
-ahlntegen.
5:0 ia a Pinortines point numa
+ | Boolean
[used Jo Stone theo Values Le. Tnue ow false . ft ya ised
potest ushethen dhe merit of on exonession $8 True oe
| Pulpe. ba
» None 2 -
Tt ts used fo olefine og mult Yorable,
jfox_example
b S=254 = Telemsilves ag a clans
|| name> "Deepak Iuman” = “identifies wart od _clays< String>
= PR a ee Foot»
ea folee = Toewtibies las class cbonl>
= None 7 = Tdewifies 204 clost< none >Beles of Defining 2 Vontable amie
21 A Variable name ton Contain otahebet ita sundestes
A Vantablé nome Can only stot uals ae ofphabet sora
+ | Mo iohite Share ia altpuocal Jo be 1 = imide
d
undensinne,
A Vanioble wowae Cam't Stoort stittte
Nantable name ee =
aa ab feu Motulable memes ome:
ee eS
eee ta Python ce :
ib Spatial Haat pen fowny Cirtatn
£9.
etek re
last 3
bed =
moo +l
|| rene ‘el eine thong the mpenands cma ‘+’
| ejsencchem
| There one Seven _obenciana is Python t-
Ht Ainthimette Openatans ______
He ptt
Le [munities too oPenandszl
Left optiand et clasp aaa ueauth
aa a a at he |
2
4. 6/5 = 2.0 i
Left operand sunised to “He Power of origi.
2e#KR= eR
“tk
Remainden of the diviston of left obenond by the
sitght. as
=
Diviatow -wet netulbA into iokale wuwnb en eee
dhe Uebt tn the mumben tine
Se FG =
Note} loon diviston Con penform noth Floats paint and
i
| nerut:
| Flocut:
onithemetic ib ene_int 1ype then
t taint Aspe. if atleast am one corqum eat 1
Aype—ihen aneault is floaf “ype =
eawient robeta ton se Ak ie oe
Saul Sign (=) 16 uArcal fo AAEM co Value to
Et 300
los SHA =
orb)Compound Assignment Gena
&
= = ———— an.
i
|
A=
I
iS equal to
is qreeten tow __Pages WN
[Deut 7
Comps leas
M Se
oy faa
= 21
paint lz Us" orb)
-pnint (Nac =b ya", ae¢ob)
Output
False
Jaws
| fama" (a used -to ae mee Pesta ate check Lohe tien
= T
Sn hea expan alae da
| ‘Not’ jA used +o inven te Boolean . Geta the obboo ite
Value}iH wise operatans
&_| iP woxth pits ane 4 tnen onjy mesolts yo_t
| othennetse méedulh ty 0.
| JGf ettead? one bit it~ 1 4hen mesvlt (64
otwenwotse mesulf tA 0.
| A Lie nds ome oiftFenent tien ouly meavlt jab
p= (ge medult ta
a bihaice Complement ajpenatas
be 1 meamA O cmd O means 4.
>? | Binaise Lely shitt ojpenatan
<£| Ribose svght Shift _obenatan
£4. print (4 ee 3
a
paint (yw5 45.6) E
1 =
1 “Type bon
— e Shift Openers use oly multiple
USMERE asi Co ee onda Shift openaten oe
divioiow . :fap: 18
ee
+} Then +i ty openfons—
one Whyed ha cheek if hoo Values
Vaniolle} ané located! om te Same Pant of the
Netvwables thet one equal docs net impale
tte cate dently cal.
[is not’? True if the beronds ane mol fcleutical.
cL= “hello”
=Aza4y Pp e
at ri
= 4234
int (xd ie Yi) iia
|| print (cd je mot yt) —
tka i 2) Siig ae me 2
Lowbput in
Tau ze
| false
i= =! er Value vohere aa ‘is! =
chensiun _fomponss ire acl ehesies.
embenship Operatons:—
| Wie fom use membenshi _ofenotana to check whethen
ven obyect present {4 the given Collechon.‘in! Regie Hiei eae ‘given enject came
tne Specified (oltection.
‘wot in! ! Retunns rue ih tue co sect mnt _hhesewt
eal ed :
in the _gyivels Sheci follectiow
eg x= “Hello oe Dhan is _eany"
ee
point Ot tin ee >
pnint ('d' in x) >? false
td’ not in X) >> True,
print (Bytom! in x) >> True
Openaton Precedence :
if multiple chemtons present thew uski'ch —ofena
yall be evaluated "Binal We Gectded yy cheat
Precedence. _
The _feliouatns, List describes -the cpenatona
precedence im Putnam
[Pinay Osten
i
eS
| <<>>
L&
4x
%, Avo ds
AAy pea and operate Mow, We Should Jeanw ohout _
fasting wolaich jh. Convent one data hype ike
teas rare =
Type Function AND Type as Tints
He function wugill be explemed. Lusrthen
[Paypet) Rmchion jo ured to Dad te sate ybe ga
given —Montable to Byny
A=Sl
Aypels ee eh ee A
be" ai”
“Aspe Ub) => clasesty>
A pasha, Can oe (onvented into a Stalag and Vice-Vena
Cree eee :Stet s)) =>31” = inten an
ink Ua") eo mg String to
Moet (a2) => a20 _ => _inteaon
Hene “B1" jaca izig ie kat Vitenal
. |[ypotl) Pun ecto S
thin Conch allows the? users to take input:
: — Ht Booted oda String.
- Tryside Peneartneala sae _ i
ilies oz inet U'Enten nome")
AS? ihe is“ Brena the user entered
: = Deepal.
Notet| if ia importat do note -jhat sine cutput ¢ input
|| JA olwaasps a. String Coven if ne num bens” ja
; | emtene a)
09. | X= input (enten some datas")
. | Paint bo)
of
Enten Some data! }23
V9 3”
| Sometimes _vae_yoeud ta plas
ie is SuNmey "