0% found this document useful (0 votes)
4 views12 pages

Python Unit 2

The document appears to be a disorganized and fragmented explanation of programming concepts, particularly focusing on Python syntax, operators, and control structures. It covers topics such as relational operators, assignment operators, logical operations, and loops, but lacks coherence and clarity. Overall, it serves as a rough guide to Python programming but requires significant editing for readability.

Uploaded by

lolap95871
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views12 pages

Python Unit 2

The document appears to be a disorganized and fragmented explanation of programming concepts, particularly focusing on Python syntax, operators, and control structures. It covers topics such as relational operators, assignment operators, logical operations, and loops, but lacks coherence and clarity. Overall, it serves as a rough guide to Python programming but requires significant editing for readability.

Uploaded by

lolap95871
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

olo2

ae f tyfes.
fytoo OratosThere

DAsthmete pratores avu Athmeic operalo


The follouwing ane

AdA

Sub
mu&

/>dv

mallarn duiuion (vetoms emaider

/ > lour dvisisn lenly prnt htaen vaa)

* eepanent
6 aint (input ("entes a ale )
b: int (input (" entes b vae"))
C atb
Paint Cc
d: a-b
Print (
e- a xb
pnt Ce)
fa/b
Pint C)
a. b
Print a)
h allb
Pinth)
a *b
n t (i)
Relational pates
Kekationak Opeato
The Sollowng ase

L los hon
Goaatar tan
p o l to

N o t eaal to
qeater thon or
eaual to

les hon or
9al to

a lo
b 20
a>b

false
a b
Te
a> - b

a< b

a b
falue
al=b
Tave
eperaos

The ollasing ane ogical tperaios


O& ot
Ond
a T
b fale
PntCa anl b)
Pmt(a b)
Pint Coot a)

oFalse
Tave

Bituwis ebeatps
Jhoe eharcts at wsed to pejom bit

Level epevation
The Solowing aac bibuise opevatos

a lo oooo lolo
b: 04 0 00o oloo

PontCa OOoo Oo0D

00

Point(alb)
o o oo |0

Pint Ca Ab)
o 10
4

Prvnt ( a)
olol
5 Assignmert hrators
oherattrs ane used to aignRe
Thee
valuus to Varualnles in shont bard repesentabo
The tollowing Aersanment ohoralors

a 5

a6

a4

all

6 Mombuzhppeatns

tuse menberip dral ul


The delleoin avl
wel to test wheatha a vakue is
Pthen,ft

in n o t in
rome . "Hell
P'n nanme)
Pnt (H
ve
not in nam)
Pont (h
Tue
eperalors-

peratos ae used to chok whetho


Thee
o Oot.
ot.
valus are epal
po object

is is not

X 5
Y 5
Paint (x is

e
PontCx not )

falge
Precedency& Ass ocalwi

pexaor preceeney Ipionby

2
* (ex ponenk)

a5
b- G
Print a+b * (a-) b* xa).
Th tak expoersien Solvevsn
0perakos psecelony
peratvy AssociatEvity

wdo opueentq enalaten


ngt to oft
wnia s
Acilos USes.

4S

Tndentaten
Tndertatien sel to the poes at te beinnin
acadle ne, whee n ethn beaammna
languages te ndertation in Cole sor
eadalhi lity
J
enl, the ndarntatien in
Py thon
mpostt
Pythen wu ndestatien t indicatt a block
code.

Con&
PontC)
a Colon as a
An uncluen endn
indertatien n he next Lne.
& Some ansuwed

Contael Srucbvse 6 Cond.birk staonen


encecuis th pooTom
T h e statement
trve Condrtion.
bacd n
Con:
Suntay
stmt

x n 5
fn 2 0:
Pint ("even numbes)

else Tt encecte the popqsn baxd


bad
false Condben
Sla con&
stau-Tve
eke
L s t m t - fhe

int (input("enttr a
number"))
n 2 =0

Print"even numbey")
else
Poht( (" aldJ nomber
nesked I wi lllo 8tmen
nside
anothes A statament
S4nlant
fCond
L cond
Hgtmt
n, 36

s 56
n>0,

rnt Cn)
wnd to mulbiou
)etThaá stalemunt s
glutien 8talemen6 Crecuti

ntax Con
stmt
elif
Stmt
else
Stmt
monks- nt linput ("esr maka "))
f narks >9o:
Pant ("s)
elee masks &o
Point ("A)

else
Pint ("fail )
Leepn9 Staoments

Loona
Loopng 8tatimerts fn Pythen ae uelto

stotament 0' code rpese


euetia block
Severa tmes as SpecPheS by e

ythen oves u
te
ox loop
loop &Lohile loop.

loops traunrsa
t on be vse to te vate Oves a

Tor o n)
Pnt ()

3
x tor Valusn sa
nce
Statznenta
for for teatian
at tuple, sti
dtiorauy
w h i l e

Pythen, a ohile loep to


b Tn
entcte a block 8tatemanta sapeatell nti
unb

qnen Conditobn i 8 a t i s e . And hen t


0
Pon
Con&rbon becomes alse, the Lne immekatoly

atos toe
te
loop loo in e pugom is ererted

SynAox whi le Cond


ststment
Coun6-
o
l e Count3
Count Count+ 1

Point (Neha)

Neha
Neha
Neha
)whn we ine enbre loop în a single lin

tbecome8a in nite loop


Count o
wnile o unt = = o

Pint("Neha")

soTE T s gested not to use ti tre o


never end n aite looP
looS
bops ag s a

and you have


wheve Condlbon is aloays trve
to forcelu teminateE he Cempiler
ta UnconFbona sttamantr
ued to altor the
These a

thrae
8tamet. Thoe
ae
Weey
statomais Supprtd b Pythen
manupltin

Break
Contnue
pas
Bvak hå a we te brak a Condbon

n midle ercutien.

X "hello"

b'ok
PntCt)
e

,
n0ntinue is atalimunt ued teship
encatirn e Cwrent Sstatement
nt s twe Contnus e
e vrer
uteer

poraiam uuulien.

6 X "Python"
X

Conbnue

Poin EC

as ka salamnt 4 ugs to nolude o)


Rhace fo bove Stalment eneeuten.

2 X "he llo

PantCt)
o h

You might also like