0 ratings0% found this document useful (0 votes) 26 views11 pagesUnit 1 - Introduction and Syntax of Python
Python chapter 1 notes handwritten
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
Unit *- Ttheduction S syntax of Python
<= . = — 8h
~eythn was invented in \aeg by Guido Yon Rossum
ot CWO ( Century W iskunde & tif rmertioa > m
the Netherland s » Amsterdam.
. Aplications of pythons. :
Y Civait side jAasheriy ee
2) Gloss 4
—s)Ayudin 2 Gabe nage (32S sities pageemelg
a Web. develapment —17}Desktap application |
ee 5} Software development 3 cation
a —$) Mathematics —14) Game development | |
—_— 7) Systena Scripting __g] AL, Multimedia |
——+_Featunes of Python =
ee
S 2) GUT “programm $$$ ____
—x-2y-High level pro age
a Be Lah e ‘poled! Th ——
ov 5 asd +o “code g vead J 7
6) on [ Platfoyen aia [cx0ss— ptm 4
>. Object oriented la. .
e 2). “Inten preted fang guage . 7
ay €asy to learn so ~
E 10} ets mo f
NY Extensible.
11) Gee & open source. ' : fe« Editers _in Python :~
ymoLe (a ated development language environment)
~~ geainnest)
. ay PyCharm (Sotlwane develaper)
3} SP dey (sciemist)
ah pier _C-Qraphinl puspose)
E Compiler! Compiles the so! 2 ints the format
2 7 known —a byte cade. “E+ canverts saurce
code int byte code 2 it 4 Sad into
aE PVM (Python virtual machine) ee
QVM. Pym is the vun sme engi of pythons it
suns the SCaP+
} Python isan imexpreten_based language thexefare
LE is _slowen than compiled based language
2) Tt_uses_.many layers te._communicate uaih 0.5 11s—
~ computer handadare. SS
apae
| 3) Python memory consumption is -also_high
—— —
“| Shacture st python. progam ets a
| eee $$
a4
| ___Documentetion Section : a.
| cncludes. comments _+hat specifies purpase 1 an
aoe
exe cutahle etatement 2
|
it of the Progvam .cemment is_a_nan-
{
Imeoch ctatement i Import section is
| “used_for_diffevert built-in 3 usen = defined | a
e Pe clei eee oer ce 4
|
:Thisused te | ee
iables fix _pragaam.
eee eee ae
Class_sechion : Descvibes the infaymation _
about the usen define classes in -the_
progam. __ re ee Be
class is collection of dato member 2memben —_
ee ee
| Pla glound section : th is the main
| Geckeon of python p¥eg2am b the main _
“section ctont whene the function callindicotes thatthe shell_is_veady to_inkexacting —
| commends . accept Sn4erachive, “Commands -
G2 print Hello eager
ss ello cae
| = Tdentfen is _aname—gj vento a function , class, ——
- variable, module aad ——
~~ = Exi-myclass _, emp— asta: -conti
Exec
assert | break | sass,
def det else elif | Excep
: -
oy From
ox. pass_ pxint | raise
oy while | with yield = oa
—
= A wnniable “js like a condainey thet stuves_valyes
! : variable = wclue _
= —
le Ee: 22> x =10 =
Eee =F eee ee ee
Be gee ye eee
j=» 10 5 _
~A_\iteval refers to the fixed value that directly
appears in the progiam.. |
String Wterals :~
at a “hello”, “12345”
— Th litevals .- -
_ o-10
~ long litevals +
$9L2B349— Float literals. © [
| a4
|— complex Ittevals i
: aj
— Booleon \itevals. 7
; true/false
\- Special \trevals-°~ _—-
none__—_——
— Unicode. literals. :« —
“pelle $$
List eka
= er r—rs
j= Tuple literals t=— ET =
| (C94, 359 oy)
= Dick. —Nidenials =< $$
tp ft}
t program +o
[=x p77 for iin wang O11) oo
1) Singleline feria!
ty Mali line coment os
= x This is first python progvam” ae| { GoodLuck [parts |
a “Fact types \s 0 type of data
— —_-waniable s_ | \dernfiers -
values stored in
SN umbens
— _—3List= oo
Ee. FTuple_— ardered_ _sequence of | fem
ee a
£. Boolean =
2 String, 1 re prents. text _chanacter, aaa
a
ial_dota toad programmer,
= es reer menge +i tepresnted
a Sen from list —
k ~§Tiekionany £3. Represents the colle etian of
E __-data associdted —caith unigue keys uaith
_ Hts value. oon
Boolean -- represents. srwth values (true /fatse’)|
iy arteqens neg — te Sp Dp Mts S
+ | Number bert
hig, Flow point Inumben,_3.14, 25, 5
4) Complex number * 1o8R , DHEAj,caathTs
+ String ! te
String sa collection | of group of characters.
(aly “ sonw” ). : = oe
in| examples ——__________—_——
x = “hello” +! python”
title
find vinden | x. find cy)» %+ ind ——
, \nderly
rar yrinden nw. aaindl y) ,% aes 5
{ cot worth x. stavtwith cy)
endwith x. endarith cy)ee qeclace . replace LysaD ) LY
ee | ship, xship,\ship- - strip ©) —
| €n~code__ . encode (" were)
——Aaeesing dhe H a
== “as
fe. 4)) 35> 5 = “Haile python”! —-feeunule oe
See ane colon value
> i = ones I
S+> Ss Fira] —> sett
> (gaa on! 4
5 C 1:5} —> ' ello! |
Shon pagan) = “a is?
EO l= s. split (5.1) _ oS}
= yt Python’ ‘Y *ptegnammning.|., lis’ y "easy ‘Jfl |
Gost urk
[ sot om
: bese meee)
es) Loe “ python programming is easy’
| ooy>s-= c J join)
—» tpgthen’ J ‘prognaraming )
a ,
“is : easy
ye = S#! Join (OD
—o \ python! te+ “programming
“yyy fi First_= Cie, 20-30} ————
8 dyz-second d= Gane!) eno sbree oa
~ 1 ‘Red’ ,2,"yello Joo! | —______—
i tis !ffteay
3) first (2110
| >>> frst C2] —— > 30
: Gast C2] = 50 —> Cia, 20,501
-— 1
| >> fist Coa => 50
i 5 oH
ag e = "python"
yy 1_=_jist CP)
4
| 5 Ge 4’ te to! int a)
GA >p>-a_= (Ciel, tabe’, ties’)
\S a fo) — 10
‘a _(Cob20—> Exrov (Gerace
! Diction = an. -uncnlened_callection. af — key —— i
| Value pairs .[ome
~ dh - oi a
YS did = {i Fivst', 2: second} —___
YS dich
yy diet [3] = ‘ third”