0% found this document useful (0 votes)
61 views21 pages

Python Practical File

The document contains a Python program to find the sum of natural numbers up to a given positive integer number entered by the user. It initializes a variable 'num' to the input number and a variable 'Sum' to 0. It then uses a while loop to add 'num' to 'Sum' and decrement 'num' by 1 until 'num' becomes 0, finally printing the final value of 'Sum'.

Uploaded by

Rocky
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)
61 views21 pages

Python Practical File

The document contains a Python program to find the sum of natural numbers up to a given positive integer number entered by the user. It initializes a variable 'num' to the input number and a variable 'Sum' to 0. It then uses a while loop to add 'num' to 'Sum' and decrement 'num' by 1 until 'num' becomes 0, finally printing the final value of 'Sum'.

Uploaded by

Rocky
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

3

h a ho4km to hihhasm arthmuHC Gfikdiah on


tuo inuh numhths
num nhut
umnhut
Sum: pots Cnuml)+ Lloas (nwma)
mun-uaw lnum1)-flaas(numa)
mul-loas (num1)¥ LLoas( num2)
Cv las lnumi) /4lwsl num? )
i ('he sun o $o}ond {13is
{a},fosmas (nunypum!,
mun))
hrint'h Ausskarion effo}andl1} is{a3°,.wnas
(nun 1,num2,nin))

muuiuion f {oYand{iis2 kesmul


tint ('The
numlhum2 , nul)

hint ('ha diuson af {o}ánd {1} is {2}'. fasms


(nml num, wv))

Cuthu

numbth 20
Entih Selany

T ulUihuusion / to n d ?o is 200 '0


v/ Si0n 0 lo ane) 2oif o'5
HAP to
genuttl nalam nwnht n
fythan
inott Aondom
rint (sanden Jandins (o, a))
cuthut
5
duut d frogsam suufh vasiubll in fython
fnd (injut("elenso erth value Jok P: "))
- (unput("Buake entek valu jot a: "))
temh-1 P
P

hhint ("Tha vaue af P ats Aluaffiny: ", P)


rin ("The value af a aliek ilulapfuny:",g)

Quthus:
huse entet Value fos P;13
l e a ente value fot G 43
Th Na af P aftt Auuupuny : 43
The value at g
aJtr Suapfiny 13
h o n hragkam to Canveki clehku Fantinis
o li4ttt teltivs

Celius =LLaat (inhus ("Temiratusu venlve irn


legke Cuius"))

Eh unhul-i (alsius_I t |.8) +32


-

hin ("T f.Rf tleyteu celsius iy eIu to:


2
Eubthui

CsLus-I, Eakunhil-1))
is-2 plawlinps ("Tnhratuhe valur n
degk
Csius,"'))
Erunhi-2 - ( a s s - *g/5)+32

huns('Thu .3L lgku Cusius is egua to


'/.4
Eahonhu

C , Fuhukis-r))
Cstus

Tmhrdu velve n chugru Cuulus 74

The 30o clulyhu Calylus i4 eUes to; G) 20 Feuhtandz


oR-
w m t h i s u u vcue tn cdutyt u l Liius' R

The 2 00 cuykuu ( A u is e.9 uas to' 71 tyo Fhtenkeid


Rhan AhayAim to ulumunsttive the use OF eldinul
Ohtutaks
C 200
b 10

C-atb
Bint (" The Aum caf a and b is', C)

hain (ayb)
RAin a b)

>b)
Aun (c
Quthus
Thsum of a n d bis 3
Thue
False
Fuye

TOUE
unnilAnd
thi hARny aL
7n fhayAum to
hiunse n i l lauul ahettaks'

alo
b- 4

BAin ("a } b:", a 8 b)


bin ( a lh:", alb )
brin ( n a - " , n a )

bAinn ( a ^ b : " , a n b )

aulhut
Ib:l4

a b - 14
ythun fhayrtm to unilutAknd the 4RLny af

hiuise antl tagictt afekdloks"

b 4
Pain ("a Y b:", a yb)
e i n ( ' a lb-"', alb
bhin (''na-"', a )

bAin (''a nb-",G^b)

alhud
a
aIb:/14

a b 14
P
e9usion
LhoAs tmash
aI
b

b (b¥ Y 2)-(u¥ a¥c)


sLw (U) /(2 ' a )
S o l - (-s -Cnsh
( b+ tmsh s U J
(d))/(21 a )
Sol 2
hin 'the alvhon Cuhe {o3 and {i}'fosmu(s1,
SulR))

Quthut
Enhe aT

ntel b5
Entes c 6
+0J)and(-2 t)
The uutions cu(-3
t h n tauytum to hint ba1en uIng he47e

JeaL = 6

cA i n Ainge (i)'
i n i , end=' ')
hrin ' ')

33 3

555 55
tha hhasrun t0 HlSAay the multihulwion

hAintnm,'y',i, '',nun¥ )

Quttut

122 24

3 3 36

124 48
1 R Y5 60

1 2 Y6 72

27 84
2 96
12 Yy 108
I2klo = Ro
hythan hhaykum to i n t the isahull se9vente
h ms=iw (ins(" Hou meny tekms? "))
h,n2 0,
Court 0

thiv ("fuse evn t


hositi ve inseget")
tir 'bnili sesunli uhto", Nesn,": "Y
hrins (ni)
eye

i N "Ehanhiu se9 wnue ")


i k Caw tniekms
h i ln1)
Nh =h) + ni

nIn2

n2nth

othis

Ho M r y tems ? 7
dAtaykam to cheuk ALmslkang Numbei
NUmigkv indlinh " Enteh Ca numbek "))
Sum-0
tmh nm

uhLuterh>0'
duyit-temh lo
Stu cligit **3
temh/-10
num- Sum

i w (nim,'"|S n AkmAuong nunbei "J


eye

hhir (nnm," iî n s an AAmsting nmhu')

Qulhut
EnleA a nwnbe 60.J
669 natn AAtlry numbeh
o hoyham to Eind Akmtlang Numss ii an

LnteAu
Loadar loo

num i Jurge lLoueA,uAJA +1)


a ;
dhtls -
un l SLA (nn) )

tun-num
i e temh o
cligit tenh . to
Smt u g i t * * aliluA

temh l/= lo

num = = Swm:

hAin lnun)
Qthut
53
310

16 34
IN
han hha4tm to mant uinhi CuuultJof
det all( a,Y)
Jutukn Y+Y
daf suhkAa (X, Y)
uwtn X-Y

ukn x/y

hin" Suu ahhsion ")


hin " |'Aets")
hkin ( "a s k t s " )
hhin ("3 MuLihy")
i N "y ívicle ")

Chaite inpus ("EnJl thoia (1/2/3/4):")


autpus
Seuw ahMsian
IAcled
2 Swh s
3 Multinly
4 i vic
u w u (i/2/5/4) :3
nt setor nurhes iy
I5 07/4'0 21o 0

o n llldisi on 7 ( Yes/no) ; no
A0A na

hiN ('{o} isa uth Yeas "


fahmbs( yenA))
euif ( yetA 4y-
0)and (yeld Y: loo! 0)
hin ("o7 ia leth Yeas Jasmas yest ))
'"

CLye
tiv ("Sc} 1ina a
datf yeas" feAnslyead))
aLuthu

2000 1 a leah yes


O tAn4kam to inl mulust umyii amby
th numbe

a-int (inhus ('tnJe firs numhet i '))


b int(inhs ('intek Seiand rmbeh'))
C n inhw 'Uteh thisel numhes :")

SmullsB- 0
4albcunl ak

b a aun bé
Snillst -b
a wd tbi
millst- l

t i v l Smius+"}
S th Jmiluj O thAu
mbeAs. ")

audbut

fntel iAJi nvmbel ! 14


31
rmhll
v e Sttad
E v ttUnumbes:67
find Smallus! N n b e t amongG
Y A o A m to
Thu umheks
nunhuk ) )
und (inhut('Entut pirsl
nuk seLand
numbet 9
ind (inhusl' nunbes:") J
'Entes third
w (ikd
Smallust 0
atb anda{
Smaulls t-. G

b a and b
Smallst - b

nwmbers")

ndet pukf Mmbet:1g

t t A eiond unbeA:?1
7
Ente thisd Numbes :
thAu u n b e s
41 the muluyt of
2/3*
eythan Pho 7n4
t o h A i Sum o Jekiey -1/2t

e hrindbhi'ethum (N)
SLm 0
A i in Ainyl l, N+I)

it)
Sun + i / li+)
else
Sm / (i+1),

i n (Jum)
1

N 10

i n s Aiuim(N)

0 2634 56
the dum 'T
gAahtoYiim to ind o/
Ntutul Numhtts
num-16
num <o .
hrint ('" tnter a hositive numbes ")

Suum 0
u l e ( nuum >o)
Sum + num

u " T Aum is", sm

authus
Th Sum is 136

You might also like