0% found this document useful (0 votes)
6 views

Python Programming Fundamentals

Uploaded by

20bscit017
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Python Programming Fundamentals

Uploaded by

20bscit017
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Pyhon Poeamming fncdarentala

* CondRon and
* Loops ela stalementa
unciorA
OlordHon
Condiion
ard bancking Yetateent
*Used to lontil Hfe fesotorcltonFalse

to
mabe clocaona
sue

Gtain londitionsbasd on
Hlconcditbn)
End
Taue Ex

[Body
b= 2O
4acb:
x- Trte dato ule.
alae:

a) a-rt Ctnpct ('Enta the n


ac:
b greatex than a else Patnt (" singfe cig)
CL=30o

b90
a BO
Yb>a!
b-5o
b>a: pnt ("bis geater toa
a)
elf a --b:
Patnt (a ard bae ega
Puirt ("a and bare cqual elue:

a and b aue eg ual


a is greatos-tfan b
4 ely ela statement
Short Pon y
b20

Conclttion False foh b)


Nested i ssatemena
aue X=25
lorolifon Fase
1 yx>o:
Psint ("Above Hen,)
Tsue
Pattard alo alore
bedy else: 201")
el body
elie
Prd"but ot aloves
aboe ten
and alo alve 20
banana J 1
opple
yes 592
eal b
rgej )Prnt
sqConlaain -oy object
rnent Baeok acton sfuce Poforao and
banana sfi)(listytpeos Sequenta
apple
loop For
fuite in
dox
bonara "hcoyres
,-'apfe, again anodnagoi
d ogoinn onske Sarne
Ex
b>a:
: n xfos stodeerd P30as
Coninue sftement
Stop the Cuesent teraton
2

LoPt next 4

"oxarge " * ohile loop

x= 'banana":
Rete a sat gsldervot
as as a Corolison
loninue
taue
Paint (x)
Eotes loop
app/e
Test False
chegy corcliton
Rarge Tsue
Eyoax in Sarge (b):
Oile oP

X=1
6 ohile xc
Bc: fos x in sangel39,) Print ()
Pirto)
20
2
23
26
29 4
Else staement
Bsecalfatenert Run aabocl ol ce cn
Stef +fo lop en +fe
ohile cohen Re lorcliion ho
E
Condition is tue
Ex
ohile x6:
Lohile c6
Print ()
9e-3) : Psint (x)
bzeak
else:
Xt4.
Pxirt ("xia no lorge
Less an 6")
3 1
2
Continue stateret 3
4
ohtle xCb
Xü nologex fecs fhan
t==3: funcons
Corfinue Tt is a bbcks t
Keusable lode tBat eyo
* Funcior uns
itis called

TE Cn he a le
muliple imes
add (5,6)
dy hllo (): Sul (7 3e)
PaiatHe lb oonld
Pint Co t20)
!)
fello
Hello ooxld Pasaretes and augarmeit
3o
Tyfosrna on Can be Prsed
frto funchons as ojurment
ane
Puo -+d (input ("Entes he Auncjon name, îns?de
po;)) tRe psenthesa
4 po-= |234 : dd s nany aygume nt
Paint ("sard hya) you coanh, Just sefueta
Psntl age:21)
Pxint ("Scoecfiee ") ffem oitk a Cmna
else
def Belb Chane)
Ph) Psint ("Hallo' t hame)
Ente thie plo :l234
Grdhya follo ("davad')
SuDeshee
Hello ar
df add Ca, b): Hellb ton
Plnt (atb) H
elo dawtd
odef Sub (a, b):
Psint(a-b)
Rekun ales
Postionml asqument
do geefg (rare 1
Pint(",j raynuned:
megj , Ketan 5

nane2")
rectg ('tom', Jey) Patnt (my-funchen (5))

hello, tom, jed 26

45

dy reetirg (a,):
gheeting(a s"eoro'", b-yjesy)
Hello torn
Dyfult fauernela Value

Pint("T cam fora" tourtby)


mfencton ('soalen)
my-furcton (Trel'a i)
my-furcton ()

I am fronm goden
Trota
Irota
BAazi!

You might also like