Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
90 views

A Program He Product Al: Produet o

A Python program to calculate the product of two numbers. It takes the first and second numbers as input and prints the product. A Python program to find the simple interest. It takes the principal, rate, and time as input and calculates the simple interest using the formula. A Python program to check if a given number is prime or not. It takes a number as input and uses a loop to check if the number is divisible by any number between 2 and itself.

Uploaded by

Kingsterz gaming
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)
90 views

A Program He Product Al: Produet o

A Python program to calculate the product of two numbers. It takes the first and second numbers as input and prints the product. A Python program to find the simple interest. It takes the principal, rate, and time as input and calculates the simple interest using the formula. A Python program to check if a given number is prime or not. It takes a number as input and uses a loop to check if the number is divisible by any number between 2 and itself.

Uploaded by

Kingsterz gaming
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/ 10

hrite a pyhon program tood he produet

product o
al
two numbers.

product of too numbers

tiost-num ber int input ("Enter youn irst No.: ")


Second.number int(input (Enter your Second No.
inal-numbep +ist-number Secsnd-numbe
print ("Multiplecahan o i ond 3 u .format
(fiest-num be r, Second-number tinal. number)

Output
Eter your fiost No. 1 2
Enteryoun Second No.12
Mullipication o12 ond 12 is :144

Weite a program to find th simpla i0terest


o find Siopo inder est
Poineipal= int nput Cnter he
poincipal :

Rote i n Gnput ( Enter ho pate: "


i me =in+ ioput Enten hoime period)
formula of SI
ST (Poincipal Kate Time)/o0,
Print Simplo inter et is
S , SI)
OutpuE
Enter the prinapal 1O00
Enter tha pate :2
Cnter the-time period: 2
interest is 40
Simpl
Orite o progwam to findhe area o cirele

area o aoelo
from moth irmport p
P= floot (input ("Cnter tha radius o the circo: "

Print The area otho cinele with rodsus +Strr)+


1 Rs str ei t r 2))
Output
Enter the radi us of the circle : 5
the orea
othe circla oith nodius 5.0 is : 78.534816

Write a
program to chack tha aiven no. u
prime or
not.
c h e c k a number prime or not
num= int input ("Enter ony Number-"
oum >L:
+oP 1 in
ronge (2, num):
F (num %) = =
O
Print (num,1 not o
prime numbee)
byeak
else
else Poin num, uopvi me Oum ber
Print
(num, u not P me num b e r

Ou put
Enter ony Number :
40
404 not O ppime numben
Write a prog.ram to +ind sum of tirs+ n notural os.

Sum of natupal number


numn =in+ Goput CEnter he valus on )
Dum 0
point "Enter a noturol number")
else
Sum- O
while
(num >=O

Sum t = num
num

print The Sum is ", sum


OUtput
En ter h e value of n: 16
The sum is 136

Write proaTamto printho


tt to pxind +able ven dDo.
-tho -tablo
sven numbe
num - to+ input
( Ender
or tn
Ponge (, L1):
o
number:"))
print (num, 'xi,'=, num t )
Out put
Coter o nuber 18
18x L=18
18 x 2 36

8 x3 S4
1& x4 7 2
18xS 90
x6 08
8 x 12C

18x8 14 y
918x
6 2
Write o progam to interchange first and last ebment
in o Gst.
intex chan ge fixst an d las elo men
nedList 2.
35, 9, 56, 24]
si ze-Len (nevo List)
SwapPin
emp nensLis+Lo
neList [o] emList Usize- L
new ListCsize -i
temP
peint (new List)
Output
C24,35, 9, S6, 12
Write
PrOTom to eversiOA a Gst
everse o Gst
Lse LIO, 1L, 12, 13, 14. 15
Lst.pever se ()
print (ls+)

OUpu
5, 14, 13, 12,
11, 1O
Write a
progvam to -
sum
oelanents in Gs
Summ elom ens in Gst
List=L5, 17, 18, 23
Sum -0

+on inronge (o, lan(GsH))


sum =sum +Gs+[
Print( Sum o all eloments ",Surn)
Surm)
Output
Sum
all elbment+s74

wite o
program to nd tha. Sma llest
number in o and lagast
Gst

l Gs+ . G.2,
81, 3, L
ninUs+[o]
moy G s t [o]

tor 1in
ronge (lan (is+)):
f Gst L3<min:
min - GstC:3
G3E max
Prin+ (
The Smolls u
pin+ (Tho Lo9et min)
brcant", max
Out put
Tho Sma las t elament:1
Tho lavgest ela.ma n t : 81
Wrte o program-tond t h e d anaet no. tn a lis

9nd Larget nomber io a st


Gs o 2.o,4, us,99
Gst. sor +)
Print ("Second large + eloman ú:", Ust-23)
Output
Second axges+ e loment 45

Ote a ProgOm to nd all even nunbers in a


Gst
Even number

C6s4 L20, 23, 25, 34, 38,uL


Hov in rong (lan (us+)):
if
(4s+:T7.2) =
=:
print Gs +1, end ")
OutpuE
0 , 34, 38
Oritee O
O GstE Progrom to
n a nagetive number in
egohgoh ve umber
Ust S-14, 1819-3, 8- 4, 10
for in onge on(Gst)
P(UStt<0
print stC en d "
Output
- 14, 3 , - 4
write o progroam o oin tuples similar inttial
elaments.
tuples (L23) (44,5),(3,4,1), (3.4, 2))
pesult
Fo sub-tupla.ioup les
FESub-tuple o] in pesuH
mesult Sub tupla [ result sub tupla [
else
Sub.tuploLi: J)
pesul sub-tup [o3- sub- tupla
Pint (ust(r esult. volues )))
Oulput
(4.2.3, 4, 5) .(3,4, LA, 2))
ite a
program o exroct dis
impor e

Us+A
21,3),(3,u), (5. 7), (8 L1)
prin+Given Gs+ \n", UstA)
emp- re. sub (r'N\C).
pes:
in+G) foy 1 in Str (Gs+A)
Pint CList o diads : set(temp))
Output
\n",ves)
Ca13) (13,4), (is5,7), (8, 11))
List digis :
L,32,S,4,7,8)
write o pragrom to ch ck oop year
F cha ek
loop yeor
yeor- fnd(ioput (Ender any year))
Re yeor %ue=O
F (yeon 10o)==O:
ff Cyeapuoo) ==O:
Pin 03 a uap year. foxm od- year)
eue:
pint(io} G nota bap year. format yeor)
else
Print (o3 u no-t a
uop yeor
else: .formoyeor
pInt o3u nat o eapi ueor.
Ourput:
formodyear)
EnHer ony
year: 9ol+
not a
loop year
ite o
+otind he siga
-o-nd Se auple.
prarom
tupla.
fmpoxt SyS
lupla. =
A, L, "e, 2 C", 3)
print C Size oTupo. t ste (sys. qer si
ze of (Tupla)+
OUpU by tes
Sze Tuplo 96byles
Write program to print
a
actors o ven numben
7Foctors oo ven nu mber
Dum =în+(in puEner number")
foc toes L
lop in org (1, DUm +l

Pnt (Foctors o
+a ctors.append )
" . £orrnod
Output (oumyascops))
Enter number 15
o

Factors o 5 -L3,S, 15,25, 5J

rite a
proTO ton d hoocto riad aao number

num- int in put CEn er


Soctoria =L
ony number")
Tf num 40:
(Sopry fo ctorial
Pxiin ,
does no
exist
elif Dum= C: negah ve numbes" for
print ( The foctori ol oO
else is 1
Horio ponge (num+L):
actoria) fo ctori ol
prin+(Tha-foctori al o numist,octoi al
Outpu
En te ony numben
Thoctovi od o is 5040
hOrite a progvom tontha division sudent
calcwlode. Gpode

Print CEnler Marks Oblnedn 5 sobje.chs


monk One int inputC)
=

morkToo e int(inputO)
mopk Ihrea intinpv+O)
=

mark Four in (inpu+O)


mork Fve- i04Gnput )
tot morkOno m ark uo0 +morkThreo
+morkhour t

Ovg-tot/S rmarkfi
tf
agS-91 on d avg= \00:
elif
ovg
Pint(Youn Godo AL)
8L ond
Ovg<l:
elif prin+CYoumGrods uA2
avg>= On d
avg 2 l :

p i0t
Cyoun Gro do
elkf u B1)
ogS= 6 L amd
og<+1:
Print CYour Grodo u 82
euf ovAsl ond osyg
<61
priot ("Yovr sado u
C
int yovn arodo
euf L D"
else
erint (Fos
rint
(Tn vaud nput l)
Output
Enter
89
Morks obtained inSsubjects
2
Jour rade u AL

You might also like