You are on page 1of 7

hogrammins with Pythoa Pago 0.

Dato:

-manKS
iqhment-2
C'hana cte set s a bunch
o identfyin elements n the
Programmind

Et-
Langua
Alpnabets, DNgLs spetal unmbols. wwite space etc
a Indivlual elementAs Mat dte
idenKhied by
calledtokens/lexical uwntt.
programminb longuaa.

Jypes 0 0eMS)Keyuwond /Reteved wod

wAitehals tonstant yoluu

Keywohdg a alio Qalled ag HeLANed words these ae havtn


Sheulal meaningin yhon lanquag
shital Ihe wonds au dekined in thi
C o
ythonintenbrote hone tue ued al hogramnain -
duntiher

5TdenKfieh is a name qaven t oa funchon,eLald, Vanlable, mod ul o


DHheh objecks taat wll ba u e d h _bythonpmtam

ample a, b,
a b and a me idenkfiRAS and a band a h2 wketn&

6 eaalu /Lonstals thee ao Ahe valuu which nevei change dudna


the eeuhon b brogram
ts alled thinq-
Seq uence o lettess enloted in quotes bnq
-Luilo

uing singleqvoE on
double quote muut md in
tings
tings cat d

One line ane calltd single ine sting


Foh CHample tem Compuute" 0 Hem"Conmpute
and
double quole
gingle quote o
s thealed wing stinos
Shinds-
MStrind calledMulh-tiuA

aLhoRL MuHhle Lineu a


1tem K u \
ocad

sianiltesthe_end o the lne wi le Scaniug


o flineLEOD
0End
he sting itelal

11 Fapo sequance is a backslash \ followed by characA


chamcten ye
yeu

ant o inset

Boolean uthal wedto rebreet boolean v a l u C l ay


alie) h bython:

1 None ileal is ued to indilateabsence e valuus

14 Op2raton9 a tokQn thact iaigggh SomeCombutakon wnen


appli edd AO a Nauiable

15.Operatp. uonkinowth a singlebperand i a und peratoh.

16Blngu opahaton oberata)n two


nem
operahd_and manlbulate
manl pulates
D Tetuun a Uult

19hi4 operaton wed to shit the bis aanumbe


tnhAbrAlkblyin lelt or rght
b dvidip the Mumber by
hoD

18 uuis e oper atur S ahe uw0d to berkomn Btwise_cole.


ihtegehs coluulafons O
Pago NO,.

Dato.

4AssiqnmertAatement is used to 'set avalu to the Vovutable

Dame in apr0grom

20 PuunchuatonS O0L Use d or punehuafons i n bython

21 Comment h e mon-Rxeultable statemert in a proqram

whlte spaS Should aluways be hene anound_operatonS


22

23 4atenent refers to an inttnuckon

doe not uie any tatement tehmlnahon gymbol.


24Python

Max ne length B Python is 14 charackehs


2E
anotheh statement
uwnichahe a bant of
26 A qrouup Dstatemends
Block 0 code blockK
funchon is called

code.
name qram iS called
24 Ainothe
betuween uppe
28python is caIe sensitve tp detect dittoerence
Case and LOwA Case

0n the LHS
Lxpressiong
2 L Vaue -
e RHS
Eprepions bM
30 R valu -

Lalled vaniable
abels
3 Name od
is_determined
he vaiable
Dunamic hyplng
meang he upe D
B2
Hunäme
ding
-maukg
charatde S is a bunth oidenkynlements in ytha
EXALpnabeis,_digils speialumbol white palls t c

2
pes tokens 1 Keqwonds
2 Jdonhe1s
3 iterals

Operatons
Spuntuatoois.

keytuwohdi 0puthon Lanqua g aindielifee.


4 5yps Aiterals - String itehals
2. Numdrkc tteralk
3. BooLean
ASpeLial itthal mone
S Aittna cotleckous

A boolean lithal in py thon


i wed o reþrl10ht the
yaluo Hau 0n Lalue) boolean

6Relakonship Dperatoh iuled to Lompan2 he


yalu e 3.
netuwuns True on falue aubhdiua t oithe-
to H od.
, Z,

Assignm@nt sadment -thon y veniakle wih azignm


statement
Ashgning sorne yalueg to multple vaiable
0 &bc-d = 5
2:Astignmg mulkble value to mulHple
vauable
P S 10,is
8Synta is of nules that dine how a bython prpram
wnitten on interpreted.

pes o Comm@nts - ) Single ine


i nale line
üMulNUO
awaus SLa
Comments withe 4tbheauote wth
)Mulh ine tommeynt wil be i n Auple
quoles
0 18 1 &2
2006 2016 201 2026 2032
Mark 2 6
Here, mark& reeys to locakon 201

eA's Say w ipUt


da
Npu 1 u perorm nbera.kon
/ 2 then t will ehouw e o r
becaus smng 0annot be dividod

1 . WuHnq convonkon pytho


The Chanate l ho a letter
Speiau Choathe Ke l ele Oe wot allewzd wth
ldpnHiS
should Mot begin with a mumbel
oPyton KUwoDYd canno be ed a2 ldunkkie
0. Input) a built in unchon obython uied o ead valuE
he u he nra Or matof input) R voniable 2 infu=
g input Ente he value")_.
int input enter Value" )
wed
wed
byhon
untKonobyhon
ntom o
buult
bullt in
in

21phlnt 0 ts a
H e v a l u e l o I A H h t S c h e e n n

o p i n p u t O

neral tormat
, end = n
print olosectssejp
pnnt Pytho isfun")
Date

5mank
lbuerea3 ,
An
1 tdnthien_can be combination
APPuppecase
ett eAs, wndelscon diqit s 0-)
he ir charact.er mut be 0 tte

peulal ahaa eA aLL not allowed a3 idenifien

Cannot Ae ytnon KUw0nd3


Ple
Undehscon e3_ Can be_uI d Space betuween mulkk

uwohdi

2
-BacKwond indeina
-4 3 - 2 -

O
2 3 4
foruwaud nduin
o acCe the rst chatacten on tnesbdns
sCo]
willge output H2
Hh a t dharadeA
50 a c t e

s [lents) - 1
hind the length o
Hhe sinb
whenelenS) i wed to

mut
3 )inale ne muutple lnesby addlna
acro
MulHlin Spread
conhuLL
0ML Cn
oack slagn

You might also like