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

python

Python of engineering

Uploaded by

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

python

Python of engineering

Uploaded by

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

Scholar NNo.

* * * * * *

Roll No.. .

Proqra 1. o wrife a PYEhon Pxram


nuubes
ind Cco otwo

Code
def heCo, b)
C b = = o),

else
Heu hcfCba, b)

b u8

# Prin 12
Cud u8 iteud:")
PTint C he acd o 6D

Print Chcf(6o, uB))


O Dutpu
g Cd 60.d 3 r12

LL

hre
PRODI TS
Expouimen Nubee #2

. o cOril e yhon Prograb0n oind


a Ju
Neutont Metod.
qce cot O a ouwben 6
furc Hion to 9Heurn he Squane 40 o
ha nwbor Uing Netoon mehod l o Squao Root
Cn.1)
Ascuung h e sqrt n as n only

T o Ccoun Hhe nusber o 1era us


CDUntd

ohilecI),
Coonta!
CalCueue more cDgOd x
0ot O. SA(IA(n/x))
Check tor clos eneds
f labs(ADo -1) 41)
break
Updae y0t
H0dt

efurn A0ot
Dut put r8.0931
a s e - = "maJn

0.00Do

PrinFCS qua re Root1))


Roll No.. Scholar No. ***

xpument Nuuber #3

3. fo co rite Python Prog vgg ind


C nwb er.
expD nenHotiouu of

L cOde
a intineutC" enter a oormber "))
=

b inEinput "eoter a pouwer"))


b=O
Printtu)
fon i in rangeCi, b+1),

rn 02ult)

Opoe
enter a quuuber: s

nte pouD0r
625

hrre
PROD TS
epsimeu Nuber

4. To co rite Py honProgram o tiod t


maxi rowu rOn u c 0 F mulbert.
teode
reo upty Ji
L L [T
agi9 umbe O elarneu fo puut in wL
u fOt input "("eokr. nwuber o ele mouya
J "))
9teaing Hl) num to ppeudeleaue io i
or i in range. CL, num+1);
elenE (ioputenher el2 rmeue: "))
Dk1.uppod (e)
pnE marimuul elemeu
ProtC" Loq eF elmu it" ngx(uP1)
peut
ner wubo C o l u n JL-:4
enlea elomeu 2
enR elenuk: 19
uer ele rnu& I
Roll No. Scholar NNo. ****

ec peumuNuulk u 5

5o rie a ghon Program to LncgrScorc

de neo rgearch (arr, x) ;


LL for iio ronge ( enCarr)

I e furn
I e ur n-L

arr: Lt,u,'E','o, 'r,'t',a', i]


X=a

PrinE("lemeu kound a t
idex +s(Uneareeorck
G.x))

elermouL found o t 1nd ex

RODL TS
P
expeUmel- Nllubprt }6

G.To write a Python Progoorn to peform 6?nory Soord


Code
9herokve Binay Seorclftu.
di 6n sarcda( wit ,0):

h l e u (ic{ 1)-1

f o r e t inley er oujolb

lo=Ndtl
elLe i tizF)id]>n:
h =raud-1
else
SeyN md

uti l12,29, 32, 34, 4 , SD,s"1


45
s ueF 6in aY- Searcl (eoit1,)

("elemut ipreseur a tndex, SE(As CeLA))


Potnt
else
Prto "elemuut C not preje ta Aiy ")

ult
Roll No. *****
Scholar No.

to peuOI m celuchou toil.


T. 7o c0rtte a
Pythen Pogreuu
Code

de cd ecttey _Co rt (eilct) :


for i in rane to, tan(aixt)-1),
SrnaleE=i
for 3 fn range (+L,2eola Jit t):
f alist 131< atist [s rmatl est1:
Small@st=3
alic L, avtLSsmattestl: auit {sanautest1

a uct-înpubC ente the nubers),spUE)


aUtf Cint(x) for x in aJuiET
col ecHou cort (quct)
priotCSorhed lirt: cud.")
Pain ü t )
LLI
Ouput
oler u icf number 3 Iy $2
Sored ic [1,2,3,4, S,67
hrte
ÞROD :TS
. To orfte a PYhon Prag1orn to pernun n9es1tou Sot
de fnsstiousort( arr)
o r i io oange t2, ben (9Tr)
Key arrTi]
Ohile J o Gnd Key <qrr[l:

J 1
qrrJ+]= key
arr 12,II, 13,S,]
taserhouSostCor)
P C Sorhed a mmy i : )
for i10 range (lsu (a))
PrinC ).d" 7arr[i)
Cukpot
Scrfeol autnay f

3
Roll No.. Scholar No. . . *******

9.Td torike a Pyhon Ps®grom to perform MenGe


Menge
Sort

Sol
LU dea omene_sort (qlirt ,dfant, eud):
Ouo -L
Tocluive"
if end-Sart >t
6d (sort +es) /2
erge -8ort faUCF, geE,myd)
5 e-ort (auCk, mid ,eud
mge i t (at, Sfas,nid, Cud)
d nerpe - Jitta litF, Stast.onuid u o )

eAt= aJtt Start mid7


auict »uid Cuc7
Sta

OAl ( l e t ti4mi Cuo mid+J<ol)


/hre
PRODl 2TS
FntCi]<uit[I1):
lce
aitt LKIsuut l3l
-Jt

Stort +i < mid


c s e k<eudi

elce
cohile K< eud
auch TE1=rightt
It
K +)

a e t = npot| Enkr tu ie a mubert :"), 3puF

auc=Cist (*)turx in aiit1


o1erfeSort (aAicF, D, dsr (qAit))
pint Sored JE',eud")
griDtuUit)
outpu
Cuvd a rey
12 11 13 S6 1
Sorlecl hay i
S6 7 2. 13
Scholar No.
**"

Roll No. .

16.o rife a ython prograuu t ind frtt o

pat 0p ouberS.

So
nums=fot (Pmpul-( "En}er anqe"))
LL
psor ( Pai me ouberc", eud-')
for n fo range CL, nurnr).
for i ia rauge (2,)

brecu

Pri (n, ed ')

Out put
n t sange 5 0

ST 3 7 1 23 7 29
pHne owwberst 3

hrre
PRODI TS
Progrrs2

LTo rife a PythonpDsofo sîmulate elllpical


Pygunl.
Tmpat Py gasne

Pra por F Syl


Pygomefoit)

Screou Pygau.disploy.cet_node(rco0,3oo)
Pygouu displo.tet-coplio(eliptit r t
Clock Py9anAime.Clock)
cfle (Jrue)
for eveut fa Pyg cuua, OULtP qeC)
feveut. type =- Pg cuu.Ourr;

SyS.exitc)
xRadiug = 950p
yRodius 10o
for doue fonrange (0 3%0,,1o);
l o t mau. C.OS (dsgrea 2 naptu,pi 360 xoctis

+300
E(matu. Sin (dasa * 2 mapi /36d) *yRodg
Roll No. ... Scholar No. .. ********'**

or dqe fo O,360,10

xl= int(matta.LOC(dig y 2 ¥ snat pi/340)

Pugasne dreuo, circlt (SCreL (TS 69,0), [3un,jso]


LU Pygau.drcuu, eufp3e CSCeRn (2TS,2sras),sD, Jo,
Pygen it plouyflip )

LL

hre
PROD 2TS

You might also like