Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Subject Code/Title: Unit:

MENTS
UNIT T DATA THPESFPRESS)ONvs, STnTE

Yau'oud Fnginecring pro%lams


Applicalun ython n Solvhng
Vakues
ntepretar and tnteace mara, dabuggtng
Python and listValiables xpressions
ard T ind floa boolean
,
stnng opaton s , Comments
,

tupla assignmant, procedona curculato


statemarb, valuo» two vauahlos,
ustratire Prpgrams: ekchango the
vaiabladistana
etuwoan tuo poin
the
the value> on

Vauiou Problem
nginaering problama
Applcaloms python
u
solving
Tntroducton t Python
Rossum duing 1985-
Van
Pythen was c veleped by bjuido a tie,
thles aBlie,
lod, ile
tn tee pn lad,
a geneca! purpase. tntepe
1990Pthan level
languaqo.
Proqramming larguago
object oñented and hih
Rython is intexpraed
at run tima by the tes preter. So
Rrthon is processed t.
need to Compile. a Progam before execuling
there is ho

Python is Tntaactivn which


Tnteactive mae.
Proqrams Python woT
k un

otacive testing and da bu9ging a


plows ocode.
allows

Easy to loarn
ceary dofned
and easily readable
A Python Proqram
is
s Vey sumpla.
|The trcture. of. tho Prog a m
Vorsatla.

Python uPjorb davolopment ofa wide range o aplicalions


to
proosin9 to WhW browsers to games.
an Scinple
tet
rang
ongngng
Freo ard Opon Souro
T i an open Souo Sof twara So Qnone cantecly
dli bude , read the. Sourca. Code e d i t t .
SHENNAL
SN DEPARTMENT
SCIENCE OF
AND HUMANITIES
Subject Code/Title: Unit:

High level lanquaqe e

hen wTiting proqrams in Python, tha proqranmers dont


to about the low levei dolails.
have uory
Por table
Python Can run on a wdo Varioty of hardwar
and has the. Sarma. thterface on all platforms.
Plat onms
Obsoc ofantad
object oriented slyle or tachnidua of
Python Suppor
thaB
that encapsula tos Cada. wthn objocks.
Proq amming
thon .
Appli cations o
Python a high lovel genoca Purpose2 Programming

lang uage thaB Ubed b davelop a wida 7ang oapplica bons


Wab and enteprise
n9, tex procaseng
including nage Processi
ncuding netxork.
and numeric data fom
lovel apk caftons uing Sientife
Embaddod Siptiqlarg
3D software
veb peve lopmont
Ranguage tha
Python t an easy exBensibla
with data basa. and Bther coas
Porides god htoq ration
standardS
qUT basad dosktop applcaltons
and graphte dosign appkcations
.

Imago procass'ing
ScieNtfic and cornputalional applicaluons
*Ujamas
Ente prise and business applicalions.
Opovating Systom S.
anguuaga deelp mant
Netuwort Programming ard Prvto typing.

FSNUA
NEOey
DEPARTMENT OF
SCIENCE AND HUMANITIES
Subject Code/Title: Unit:

Python- TntapreBe.
Inte pralea
To execute a Proq v a m
n a highlevel Languega
rons la ting One line at a time is calladtntes Ppraleu.
Comslos high lavel Language
To translate a Pogram wntten
a

low. level language


atl a Onca.
into a

Inteproter
pro cassing
Socuco, Thteaprate odput
Lcode

Compilo
Pre Pre
Pocassing CompiloProassnMachino soutput
Souco
Code Codo

and Inteuprate
DHouona batwaen Comples
TNTER PRETER
CoM PILER
one
Scans tha entire
Program Translatas program
Compila bime.
transla Bes it as a low laval stabement at a
and

language coda ü
No Tnkesmediake objeck
Tnkamediata ojeck code a Geneatad Generaled.

statemanis aua
Condibonal control stataments ad
Cond:honal Control
executes Slowe.
Ereutes faske.

Mamo Raduirament ä mora,bcaus Memony redulrement lass.


Memo
objec coda eneuated.

NSTTUTE F
DEPARTMEAUMANITIES
Subject Code/Title: Unit:

Proram nead not be Conplad kvey hme highes lovel program is


eyey time, FrroTS a a dis playo Convaited.Frrors aue
dioplaye
afler entvd Proqvam u
Checkad.for evey hstnuelon Tnleprald.
ExC, cH, Compiles
E Python Rcky.

MopES oF PHTHON 2TER PR TER.


Python Intepreles a Proqram that readh ard exccudes
Python Code Tt uses tuo medes a Execution
Tnteacdive moda
*ScripE moda .

Inteuactva moda
When wo type tha Python proqram in unteacBye mode it
dioplays the rasul mediatoly.
The charron > the prompt the tntopratos uses to
ndlcale that it Teady to ente coda.
Ceg) 9 t
loo
» print (e Tntoac tive moda n python ")
Tnteractire moce th Python
ADVANTAYES
Python Tnteiackme: mada. i gpod enoueh to lcan
exporiment or Explora

Nosing in
un nteiactre mada. Convenient jos beginnars
and for tosting Small Codes:

D1SADYPN TAYE
We Cannot Gare. the Satemenb and hare to' relipe all
tha Staleman Onca again to Te-Tun them

STTUso DEPARTMENT OF
SCIENCE AND HUMANITIES
Subject Code/Title: Unit:

Script moda.
Tn Scrip modo , type python Proqpam n a l e ard store
the le with
wth Py
P ExtonSion and use the Unteprelos lo execude
the contanb of the Jle , which b callad a eript
the
does not aukornalically diplay rosulb.
ython Seript mode.
uwill use tha
the
In ordes to cea oulput Jrom a
python Seript, we

list Values and


slalemet takes of a
Print State menb. This Filo
on tha Standad outpu
Prints then Sbinq represenlalion
terminal
The
The slandaud typically direcdel to the
Fta oculput
window.
a 25

b 9
C = atFb

Pint(sun;"c)

Otp
Sum 16
betwcon Intesacti ad Sipt moda
Difeono
Thteaacin moda &ipt mode

A uay using tha- python A A way u i n g tha python


Aua ard execute
sBaemensdnteprele toed
Intepretes by typing statomerb tn a Snpt.
Pompt
codaCan Sare ad edit tha Code.
Cannot Sara ard edil the
the esulb
We cannot sec
We anSeo the yosults
tnmedialey tnmeiato

CHENNAI
NSTUTUTE DEPARTMENT QMANITIEs
sCIENCEAND HUMANITIES
Subject Code/Title: Unit:

Python TDIE ( inloqratod Devalopmanl eaTnig Enrironment)


wrks on dfferoant falfovms . al Conlains the shellusndoto an
tnteachre intes preles , douga and a mull'window tert oditor
ord
thad has cauras Gke python Coloriing, smaut hdenl
auto Complolion.

Dabuggi
us to d locatig
Deb13
Debu 99ing tem is populaly
proqran . Itb a
Procass
Systemahe pocoss
P r o c e s

and ectfying e r r s n a
datoch a pYoce
dlofach
or
a piece
tha nunbe sf bug
s

Spotbn9 ar #ring behaing as expocfed.


expected.

Seftwde So that the software S


when Various
tnpartiCulat
Deugi hade or Complex systems & kern
yslen
Ona $y
n One
ov

Sub eysterms qhtly ouplad as chargas


anothe.

tntesace may ause buds to emeqe

Types Ervors
Syntax EroTS
Semantic Erro7S

Runtime Errors

CHENNA DEPARTMENT OF
ECOy SCIENCE AND HUMANITIES
Subject Code/Title: Unit:

lor) Valuos and Tpos


DaBa types available n Python
Storod the momory C a n
bo o man
Tha dalta
tha type. of tha. dala,
that a goingto
going to
tys Data type
accose wthu tho Proqram

has sir basi dala types


Python
s @Tuplo Dictionay
Numerne gtring9
Booloan
Numeri Data typ: to a
nunerc
nuimerie lue.
aalue.
tha nama Cuggesls rajors
Numbers as numbers Python proqam
Thase
wo Can fou types of
wse
and
Complax numers.
and Complax numers.
point
tnclude tn tegers lonq integeis, floatig
to intagers
a9 untagers.
whola numbers are rtorra
Callal Lonq tnlogers, long
nlegers
numers aa
uohole.
er
as the Suffi
must hareDr' ' ao alla
alla floaking
floating
numbors Qie
hunberS oriactional uplo
aceuvate upto
T h e Teal nwmber is

Point nurners A floatog point


A

5 doumal places. ohoa


nunbers aro Lwiten n the form p ,

Complax
ard y tho imnginany pat
the noal paut
a=46 298 Floa
F Intog ype a) S b = 13 . 9 5

class: ut s S> type Cb)


class floal >
>S =IM496s32 L
long ype C Complor
> t e Complex (s,8)
clas long ss ye
cass Qomplex

ENNA! DEPARTMENT OF
H eY SCIENCE AND HUMANITIES
Subject Code/Title: Unit:

Strings
Corsist
Stin
Stnn a sesuene ocharacters, Lohich may

fetlerS , numbars, Specal Smbols 0T a ambi nalion of these


types rpre sented by single * or doubla quotos.
quotas
cannot
T an Immulable data typ , which means we

the Strinq Onca it is Creatad


modily we an use triple
we uant to specify maltilne Srng
quoles "
Str "ythen yey
s l r - hello'
"university"
easy to ldn"
>S Str =

>» type lstr)


>> ype lskr) > type (sbr)
class 'stria class gtring >
class 'slring'>

ony apa malching quoles


are
A Sring Consisting of
callad empty sring

ist
Tang D ornpound dalatypes often raferre
Python ofers a

list b a n ovdend Gaquorca ovalues of any


toas seduenco.

dala bypes (int, float,sting.) elemank hsde a


the
A st created placing all
Commas.
suae brackat [I, sepauated y
'weltome']
Cog)
g) lst _w,o, 48.5, "proqram ",
> pnnt (st)
welcome'
Lo, o 28.5," proq Tam"

ENNA DEPARTMENT OF
hHSTTUTEG SCIENCE AND HUMANITIES
Subject Code/Title: Unit:

To access alam ant trom a ist,

l s t da . CJ to aCcass a n elarnent
We Can use tha. undex opocalor
üst having T eloments
Tnder Starts Jrom .
a
t a a ist.
wil have em to b.
tnder

st [a''e 1 'o' 'u']


=

ce)
Ce Print tl»t CI)

Cn) Negativa Indocing


Cn
dor s Seduancas.
Python allows negative tvdezing 2 to
to the last item in the list-2
The ndex o - refe»s
l a t item and So on
tha
the Second
4.96J
st 'abe", , 2, 3, 'yz,
pint(st L-1)
4.9
Tuple:
The Values Can
Tuple
A
A ba sadtuenta valuos.
be any type and they a r e nderad a teqers. Tuplos are
Comma Sepauated liy Df Values,
Unmutabla. Tuplos
ae

'e'
>tup = (10, ao, 'a', 'b', 'c') lor) tup =
0,20,'a, 'b,

st a not necessary to enclose tuples Paren tha.sis


N hare to
with Sungle element ,
we

To
To Creale a tupe a

clude a Commard Jiral.


>>s ti 'a'

ty tt1)
Kclass 'tuple'>

ENNNO DEPARTMENT OF
S L O sCIENCE AND HUMANITIES
Subject Code/Title: Unit:

Anothee way to Creale a tuple by using bult -tn

function tuple wo Creale a tuple wth Ko arqumen ä


tha & referred as emply tuple

to ti= tuple t frult )


s prit t
' , ' ' u', " ' t
Print ti[ej

whuch means wo CannoB update


mmuta bla.
Tuples are ,

elemanls. Bul we an replato


change the valuue of bupla
One tuple with other.
5)
>t C1, 2, s, 4,

>Sprint()
'a', 2, 3, 4,5)

Dictionary I} Contains
a knd of hash tabla.
.

a
Dictionavy datatye erclosed Cury braces
Dicbonaries are
keyValua p is
ko Values Can
e assgnaad
access ad wsing Sduare-
and
3
brackab
be almost ary Python typ
A dictionary key Can

'Age 2o,
Add':xxx' 1
Cea) dict Vame 'AnA

Print dict. koys t)


dicl-
kes t name', tnge", ' d d )
values e1)
sprint (dict .

20, x*x )
dtct values (c 'ABn'
Prink
Prink ldict)
'Nane: PAApge';20, 'pdd':
'x*x *
F E N D A A DEPARTMENT OFF
SCIENCE AND HUMANITIES
LS
Subject Code/Title: Unit:

Boo lean
Tho. Sumplost built n tye in ython the bol typ
it 7opve sents tha trulh Value» Tre or alse

>s x= ruo.
y = False
leg)
>> type(r) typey)
Kclass beot > class bool"y

None TyR Null Value,


Constant
h Python . T i a
b a special Jalsa.
Teturn alsa
None
None
None.
wil
il aluays retun
other than Craale
Craate
Compa va anythng
Compa ra
Variabe
Variake , , but we cannot
Nono to any
w e Can assign

othes None ye objecs.


Ceg) type (Nona)
class 'None. Tyra '
None = =0
False
Nona.
>> a =

Nona
> a =

Yariablas Fxpressions and Statament

Variablas
A Vari ala. is a name tha Tefers to a Valua
Teserred
memory ocallons that etores
Vari ablos are

Values T o idon fed easly each Variable fiven an


appropriate nama

tog) subjec! "Python Prqramming "


S am = Aso
P =3.14
CHENNAI
NLg
DEPARTMEN UMANITIES
ScIENCE AND HUMANITIES
Subject Code/Title: Unit:

Tha Jirst sBaloment Croates a Variable subjecd


and ussi9 ns Pythan Propammìn tha Cecond cBate men to 1
third
Vaviable am ard asiqns 450 to H the
Creates the and assiqns the Value. 3,14
slatement Creates ha
Varabla pi
Vasrable> Qra otamples ldentifiers

Rulas must e an undos scoe


The sirst charactor a n idantifro
lette.
C-') or a
X aa not the
Same
ase Senditve (eq) ard
Taont fers a r e alaval
chaacls Suchas , s and 7. aie. noB
Punctualan
wi th un idenfers
koyword anno ba used asidend:fiars

Tdenk fes an ba. oany lengh


Expressions ard Batemenu
VaT ables
ablos
b a Conbiration af Values. Vari
An epression Cormbina lian
n Python any Vald
An ezpression
ard opeiators.
ardterals and Varablos
opouator
Sum = at5 rithmatie eyPresson

ab a==b #Ralat onal expresson .

a and # log cal xpro ssion .

an
thsBruc n thal tho Python
A
A slalamep!
eecde
interpro te Can

hava two e of statement


Cwa
n thon
Ass?gn ment Statemant
Prind Stetemant
NSTTUre oe DEPARTMENT OF...
SCIENCE AND HUMANITIES
LOG
Subject Code/Title: Unit:

AssignmcnB slalements
the Value to a riable.
Assigns

Phint SBalement
print la)
too
Tupla assanmant:
assignment to all of the eloment a tuple
An
An
slatement
assignment
usin
LSi ng a
single
allows a
tuple oflaviables
By using this feature
using
to be assigned aVaues
ues from
on the- let the
of an assignment

the asignmen
a tuple. n ight
a,b: lo, do
Cog) Prtnd la )
Print lb)

two Variables
-

Tuple assignment
) Sunyo
Suay
a =lo
b 30 udped
30,10
a,b- b,a
Print la,b)

es
Variables tha left and the nunmber|
Tha number of on

Values on the ght


g hl
hare to e ama

GHENNAI DEPARTMENTOF
SCIENCE AND HUMANITIES
LCNOLOey
Subject Code/Title: Unit:

Com ments

starts the
with thehash character
A Comment python
to the end of the phy si cal ine
and extends
b
Very easy
oComments ython
Hakang
Ha king u se.
Cormment lina. t o put Code
Qan un clude. a

Ou Code
Coce ard
Can
be used to explain Python
Commcnts
Tectablo
ma ke. the. Code more
hen tosting
to prevent execu ion
Comments an a uba

Code
uotalion . . . "*)
*) for
for
Tiple
ë alSo poesle to
u
It
multiune lommeni

TyRSf Comment python


main knds of
Conmmenb ython.
in ython
throc
here are
a

They aue
une Cormmens
Singla
-

*
Multi üne ommen
ommenb :
Sngle une. wtth a hash (1) Symbot and
wne nment bequns
Singla should ba
Should
A
thal the whola lue
menti oning
lune
une
we-ful wndithe end o the
Consi docod
omment ntund
n.
to a Vaiakla
asigns
n 50 # 5 0 value.
#

i n a . ammenls we
ua necd to bmment
need ommenl
Vhen
Mull ine lanmen u s e ful
double quote ("
duote
lines. In ythen tripla
on many used fo Hullne ommen!tng.
and single quole ( ) are.
Author ; Ann

Dept CS
Se cdion A

SNU DEPARTMENT HUMANITIES


OF
neNGLOgY ScIENCE AND
Subject Code/Title: Unit:

Literals
Litoras a raw data ,9iren
a
Varia bla. (o) Consanl .
Variaus tyes o terals
terals
thee are
Tn Python
Numevt lerals
Slri nq ilorals
Speial lorals

*Boolean lerals

Numerii terals
immutale .Mume7L teras Can
Numeric tnas are

be lorg
belorg to dferent Numeri cal TRS
loati leval * Compler tesal
Intege tera
numbors
kegular unteq Nomal tnlege
Cea) >ya = 525

Print la) >585


>
octal iterals lbase )
tndicata. an octalle ral we
wllue the ProjJix
To
Casa 8)
Oo lTDe (tow fotloud uppe lo) Lower
Oculpud 6
> Print (z)
ileral Cbase 16)
Heradedimal wll the
dicaBe hoxà decimal teral we use
To
lov) Or.
A
Ox Lybx1b= b
Pref
Eq) >> 7-Ox A to xlb : lbo (4)

>print( 166
b
Sloal teal f-hs.a print (1) oudpu 4s.b3
Complar bile.al >>a - 413.5) >print (a) oud pud4t9.5
Booloan Lloca): >S a ru print (a) adpd Tua
TTuo
Stnng tea s S: "siring
"
>>> audp String Jitexal
Prin1 (s)
Spocial litoual s a : nona }a==none DudpdSpeuial
iteral
pTnt special uteLaj
ENNA DEPARTMENT OF
SCIENCE AND HUMANITIES
NOOY
Subject Code/Title: Unit:

yacadanca fopeas
thal uod lo mani puloo
Oferalors av the Construcb
avo

ncude. 4, - . +
the Valuc.
o opeands , o e hasid oporand,
and

Pythen surpor ooalors


djfeon! pes of opoalors
Athmel? ope raBors unary opovators
Cempa son pera torS Btwse Oporators
AsSanmen oevaBors Hembershp oforaBors
Loy, ce opexa tos 4Tdenty ope ratovs
opeTator s Precodana and Assoialiity
When an expreson has more. than ne opera tors then
it the. Te lafie Priori ties of the operalors with res pmcl to
each thaB dolamined
ofher tha order n toheh the expre
expro Ssion
Ssion
evakuatal.
operato7 Description.
vponen lialin
Comple ment, minus
unary plus unary
Multi ply, dii de, modulo, _ard flooT
divison .

Acdeition and Subtraction


+, -
lef and rgh shft opomator
Btwise AVA, B.twise Excuue QR ard
Re qulau oR

Compai Son 1 operator


Euallty opo.ators
Assgnment epealors

19, iS not dendby opeLator9


Un, not n
MarnberShp opeaBor3
not, or, ard. cal opeators
Unit:
Subject Code/Title:

ILDSTRATIVE PRoRANS

two Variables
the Valuos
Exchange Exchang
in third Yaiable.
in
a- nt (input Ente the first number "")
the. Second number"))
b nt (inpul Enle
Print Before Suap") Outpet
pint "a -", a,")b=", b) Enle thanst nunbe
temp a Ente tha Se cond numbes 3

Be ore Swap
bternp a & b=3
Print nf ter Gwap") Afle Swap
"b=",b a 3 b:9
Pi "a :
", a ,

withoul usi9 third Vaia ble


"))
("Fnte tho frrst nunbe

a= t (inpl number "))


the Secwrnd
b: t (hpu Enle
Print Before tuaP ")
"b= ",b)
Print"a= ",
Qdpd
b: a-b

a = a-b
Foto the fvs numke
Entos the Socund nurner: 3
Print nfter Suwap')
"b= ", b) Bejore Swap
Print a - ", a,
b 3
a =
-

Pfte Suwap
Q 3 2

HASCIENCE
DEPARTMENT OF
AND HUMANITIES
Subject Code/Title: Unit:

Craudnte the Valuas Dn Wauable

def ar ld, n):


Jor un hange (o,n)
Lon CD outauh
obtalon C5,1,2,3,A
whle jo; Rotalian [4,5,13,3]
lemp J51 Rotatuin [3, 4,5,27
Atj lj-
Lj-) = lemp

J
Print (i,' Rolalion,&)
[,2, 9, 4.]
ar (1,3)

Dis tanca batweon two oint


umport math

d distance. (,, y,,, J2 )


dist =malh. Sl (t2 -K)** 2 +1a-4, )+*2)

elurn dist

d dslane (,4,15, 16)


Print pistance.
between tuw points',d)

Oulp
beluwcen tuo poin
Pstance
b.9To5l214 847714

o
DEPARTMENT QMANITIES
SCIENCE AND HUMANITIES
Subject Code/Title: Unit

Extra Program. Progam to Compute stmpte


OProgram to
jind tha area ard In tarast
aTumjerena a circle P=int (irut ("Ente the pamt ")
"))
the. adius"D n= ht linput ("Ente no.of years
T-Sloa (inpu Entee flaat linput "Ente the
ale of Int
3.14 ¥r* Y
area
S-ptn* )/00
*Y
Crcumz 3. 14
Priot snple Int=", $T)
Print (" Arna: ", aroa) odpu
Hiot circum",Circun) Ento tha pamt 0000
5
Oupu Ente no. of yeas
12
Entes the redius Entes the eth of Lnt
Area 28.9519194999 Gtnple Interest bc00.0

Cerum 8.84

Colcis Pogram to ind t e sum ard


av9
Python Proqam to Conver
F thea. nunbars
to aon hei (" Fnla a")
the. condi qele")) |a :itlinpd
C-Jlom(toput ( Entee
bit (»pd (" Ente b')
S- 1.8 *c)+32 int Cinp ( Ente c"))
is ",f)
PintThe- Jarenheil
= Sum atbt a

ar Sun3
Oct pu Prnt('sun: ' Sun,'Av9:, avj
Otput
Conigrade. :45
En tee the Fnle a IoD Ente b aco Entec 300

Arg 300.
The Jacnhe?l - 13.0 Sum boo

to axchanga the value


Mthon Paqan to
convet faranhat Progran
two variablos uing tupla axignment
to Conlgpada. a unt Cinput (" Entes a "))
f- flaad tinpul (Enle tho faucnheit#) |b - öt[inpu ( Entes b"))

C (f-32)|1.8 Print Bfora 6wap"


) Prnt a ", a,"b= ", b)
Pint ("Contiqade =",
-

a,b b, a
Oudp Prin" Afte svap")
Enla the faicnheit yale. n3
Print a =", a, "b- ", b)
Con 19ado : 4s.o Ouru
Entea 1o Fme b 2o
Bejore Suuap a =
Lo, b: 2o
a 20, b=o
Afte swas

S
DEPARTMENT OF
SCIENCE AND HUMANITIES
Subject Code/Title: Unit:

Proq.am to calaulale avea ooa


triadgle lusi Heron's ormula)
N
*stde of
a-floa inpu! Enle the
the tiangle )
the aside
bfloallnpd[*Fnte
tha hiange ")
c- fbal (npud Fntes the gdsde di
the tiarla
S latbie))a
QTeQ -S+ (S-a) * (s-b)
* (s-c)t*
0.5

pintPrea ", aroa)


ourut 1
Entea the s i d e q tke. triande
1s
3d side t he lrlangle
Fnle the w
the trtaala
the 3ds'de
Fnles
hrea 56.5b85424949.

cHENNAI DEPARTMENT OF
SCENCE AND HUMANITIES
Subject Code/Title: Unit:

Tuo Marks

Dofne Python ?
Python s an objech oriented hgh leval language
and mu ti purpase Programminq languag
'tnderpreted ,a na mic

Ugive the jeaturas Python


to use
* kasy
txpressive language

Tntepreted longuage
Cross -plalfomm larguage
Froo ard open SOurce
+objedoente language
*Extens ble

Whod Python inteprete

The engne tha translakes ard runs Pythonis Callad


two w0ys to use i t
tho Python tnteurete Thoo
tmmediale
ummediake mode
moce. ard Sipt made. . The > alled the
thdcate
Python Pronpt The thtepretes es the prompt to
tha t ready for hstnuclin
whad meant by value t python ?
A Value is One o tha fundamental things. k a

atte 01
a humber that a pmgram manipulaBes.
a

Python ?
Lis He standaud daa typas Python?
TYre NumberS strings ist ple
Dhetiona
NSTUT DEPARTMENT
CHENNAI
RSY
OF
ScIENCE AND HUMANITIES
Subject Code/Title: Unit:

mode ad made
6.PoLanta betwean nteLactive eipt
Tnteractie modo Scipt made

A uny 1 w g he Pythonn
P way ing
the Pythan
ntepre te tread and exeuke
nte pretes statermenb
ytypig Statemenb n a ipt
at prompt
edit the ade
edt tha ada
3. Can Sare G
2 Cannot o ve and resu l t
no See the
se can
3. e can Sae tho resulb m medêatey.
nnediaely
by an dlantifer
7 stout tha rules be tollawed Cundetscor2
Comnalon letters, diq.t
Tden"fier Can e a

Cannot e mel as denbtfers


keycwords
Coords
th a digit.
Start
An
An don bfies canno Lka!,@,#...
E k a ,@,# au
h au
Symboto
hve cannol we
ary special
denifer
Idenilerss Can
lo 6 any longth.
words t python ?
8Dno
reserr
Coovds t Python
Pthen Ne annot
the eser ed Cvevds othev
twords ae
Key name or any
Vaiatla
Vauala
n
naam
maa unction
as
koywora the Syntax shuchue
wbe a
ued b dofine
identier Thay
thethe pythonlangu
not
F a s e , True , f , wkilo
Ce)

Deneunchon
s b pmram
Whuch Conss
sts of sels sf
a
Functi on
tosk
tnglructh ons
webpeform a peufe lage proqram
,
A

to small bus ldiog locks calla unchon


s ct va
CHENNAI DEPARTMENT OF
INSTITUTEr SCIENCE AND HUMANITIES
NOLOG
Subject Code/Title: Unit:

10
Defina Expressions ard Stakemenb ?

Expressfons
is a ombinallon f values ,
variablas
An kxpressi on

and opeators Ega b+c


ablc
statemenb
inte pre tev can executes
Snstruclono that a Pythen
Oue
allod st akemant
statement
#assgnmant
a =13
Pint Statement
Prnt la) #

IDaine low oexecukon : executad u Callad


Tha brde n which Statemenb
at he fret
Ercuuhion Erecuhton abuwap bgins at the fret
the tlas
.

ae
at
ecubed one a
SBatermenb
State ment he p
tho an

tima un chon deiniliond do


,
not altes the flas o xecuho
the PLoanm

Peine paLamateS ad avgumens en

the Values provided ttha parthests


PaLa melors e

wrta anction heade


whan oe

Ceg
cog da Sum la, b) :

the value povidad


Arguma» uncioncall

Sur )
ine modules Python
A madula u a Jla Containinq
then aRHon
uncion taBomants ard thstructona

CHENNAA
INSTITUTE
TEHNOLoY
DEPARTMENT OF
SCIENCE AND HUMANITIES
Subject Code/Title: Unit:

4 Mention the types agumenb u y ton 2

kozpord augumens

peault angurnan

Redurergumens

Variabla longth aYqumenb

I5 Some buiIt o madule» Python?


st
math madue
nandom

thraading
Collechors

strin
time
tknt

ENNAIC
TCHINOLOg
DEPARTMENT OF
SCIENCE AND HUMANITIES

You might also like