Experiment Expt. No.
Name: 5" WEEK PYTHON PROGRAMS 5
PES Problem
Date
Statement: CoUNT NUMBER OF
UNIVERSITY VowELS
Statement:
IN
AGVEN&8TOKE SER.11|u/20al
AST
Woite aa
Wnte Progtam to ceunt the numbes of vowels in a given shTug
and store in a pasale iet.
Asr inpuk ("Enter srinq ")a
print ("Origmal sring is: ",Ist)
Count 0
neuw_Lst =L]
for in lst
==a or i=e o i="i' OT io'of ie='u'):
neu let. appendE)
ount= ount+
print ("Nuw liet of vovels is: ", neurlet) 1 D
print Number ovwds is: ",tount)
OUTPUT
Entu a
shirg rishilo is te bus
Otigmal shiry is vidtlo is the bs+']
Naur list vouads is: i','i', 'o', '",'e',V1
Number o Uowels is 6
Faculty Signature
Wnt a pextem the elwmg opeqallowa uSMA gven
program to ,
Experiment Expt. No.
Aist as mpu sarak tisks srivgs& vumbera,
(a) ueake Name: 5 WEEK PYTHON PRoGRAMS 5
6)Lowes ahings
sOTt in asonding otder (c) 3oTrt rumbet ist from PES Problem Date
to iohut. A) Aort number st fom kighest to uat UNIVERSITY
Statement:
19 u abal
OUTPUT
t L',3,K,'7,Y,I,1,0,5,2,&,0,3J String valuLs in list: Lr,",s)h"L]
Count 0
S [3 Number voaluws in st ,1,0,5 2,9,0, 3]
Siriny sorted in abcerding onder Ch',u ' , Y,7;]
(ay for i in st Numbars in ascundung des. LO,0,1,2,3,S ,3 1]
type0)== sh#an also use isinstance.l,sh) Numbers in duscuding oTderL,3,5,3,2,L,0,0]
[Link]) 3 Given a herucguneews ist, Cedre parake Rsks fon affaurt txea
elt type&) int
==
odata. wtte a pho proram to ockieve the kauue
[Link] li)
Lst PEsU", D,a,3,4,53, python", (5,2-5), 100, 2003
PrintSrivg valuus in ist: ", s)
print "Number valuus in list ", n) S L1
t C1
[Link] Count 0
print("riu sorled in abudiug Ades",s)
foriin st
(c [Link]-0 ype ) list
print C Numbrs in ascudwq otdur; ", n) Lappendli
An.9ort (vemers=True) elif type li) sh:==
print ("Numbrs in desuduug ofder: ", h) [Link](i)
dif type()=int or type= a
n-atpendi )
t. apead&) Faculty Signature
Experiment Expt. No.
l)
Name: 5th WEEK PYTHON PROGRAMS 5
prin Aist dlanunks are",
Print ("9hing damanls are ", s) PES Problem Date
PrintC"Numer aluenls are", n)
UNIVERSITY
Statement 19/ul20a
prin ("Tupl dwens afe"t) 5| Write a
pgthan proqtaw to find the sum o diagoual elamuts in
nesked aD" iat.
0UTPUT
n= 3
Aisk elument are: L,2,3,4,3] a-
,a,41, (t,s,61, Ls,8 ,12]DJ
Sring damená ase: [Pesu', 'yon Sum-firstdingoual = sum(atinCi for i in Tangeln))
Numbes elkmenks afe Loo,200J Sum uond-Aagowal sum (aCn-i-13n-i-] mi in Tangeln))
Tuple olemens an:
L(3 5, 825)] print (sum first diagovol + Suam [Link])
elemeuk OUTPU
1)Wrile a
program tb find the tuaunoy otu kasqost
n the list Aist may Contain duplictes .
Lst 100,56,45, 3, (00,5 Wrie a progtaw which accapls a kquance o omma-epataked
Count 0 numbecs o uer and generates a üsk & tuple d owry nuubes .
in kt:
inpur(Enter a squance of numbers: ")
i
.
for
e max(st) asplikC,')
L= n
print(largest dauak 1s: ", t tuplen)
prin CFraqueGKHolasgat dauur is: ", [Link](e) print ("ist:",L)
print(Tuple: ",t)
OUTPOL
is
hatgest oluuent lo00 Enker d umbeya. 1,2,3,4, S
a s4qunce
kisk:C',a','3','4',s'] oUTPUT
rauacylasgut eluuut is' 2
uple ( , a', 's',4',S')
Faculty Signature
Wrile a prograu to find tha Tupeaked items oa tuple
t (a,4,S,6,a,3,4,4,1)
foriin t
[Link])>1
print G)
OUTPUT
4
4