You are on page 1of 2

Task 29

Simple Calculator

sef add(x,y):

return x+y

def sub(x,y):

return x-y

def multi(x,y):

return x*y

def division(x,y):

return x/y

a=int(input())

b=int(input())

print(“chose you want *** 1-ADDITION 2-SUBTRACTION 3-MULTIPLICATION 4-DIVISION”)

select=int(input())

if select==1:

print(add(a,b))

elif select==2:

print(sub(a,b))

elif select==3:

print(multi(a,b))

elif select==4:

print(division(a,b))

Task 30

Vowels and consonants count

def count(x):
vowels = ‘aeiouAEIOU’

count1 = 0

count2 = 0

for i in x:

if i.isalpha():

if i in vowels:

count1 += 1

else:

count2 += 1

return count1,count2

x = “PYTHON PROGRAMING”

vowels ,consonants = count(x)

print(“Number of vowels:”, vowels)

print(“Number of consonants:”, consonants)

You might also like