Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

ITWS midsem 2 part b

QUES 1:Part B

f=open("avg.txt","w")

for i in range(10):
     f.write("%d\r\n" %int(input()))
f.close()
fh=open("avg.txt","w+")
sumi = 0
count = 0
for line in fh:
    count += 1
    sumi += float(f.readline())
average = sumi / count

fh.write(average)

OUTPUT:

QUES1:Part A

def Check_Vow(string, vowels):


     
    string = string.casefold()
    count = {}.fromkeys(vowels, 0)
     
    # To count the vowels
    for character in string:
        if character in count:
            count[character] += 1  
    return count
     
# Driver Code
vowels = 'e'
string = "azcbobobegghakl"
ITWS midsem 2 part b

print('Vowel with highest frequency is:')


print (Check_Vow(string, vowels))

OUTPUT:

You might also like