Program 6. Menu Driven Code - Tuples Aim
Program 6. Menu Driven Code - Tuples Aim
PROGRAM CODING:
def tup_vow(t):
print("Words contain all 5 vowels are")
for i in t:
l=['a','e','i','o','u']
for j in i:
x=j.lower()
if x in l: l.remove(x)
if l==[]: print(i)
def bmi_chk(t):
n=len(t)
for i in range(n):
bmi=t[i][1]/t[i][0]**2
if bmi>=30.0:
print("For the given height and weight",t[i],"Obese")
elif bmi>=25.0 and bmi<30.0: #25.0<=bmi<30.0
print("For the given height and weight",t[i],"Overweight")
elif bmi>=18.5 and bmi<25.0: #18.5<=bmi<25.0
print("For the given height and weight",t[i],"Normal")
else:
print("For the given height and weight",t[i],"Underweight")
#main code
print('''Menu
1.Showing words having all 5 vowels
2.To check BMI
3.Exit''')
while True:
ch=int(input("Enter your choice"))
if ch==1:
t=()
n=int(input("enter the number of words"))
for i in range(n):
word=input("Enter a word")
t+=(word,)
tup_vow(t)
elif ch==2:
t=()
n=int(input("enter the number entries"))
for i in range(n):
w=float(input("Enter weight in Kg:"))
h=float(input("Enterheight in meter:"))
t+=((h,w,),)
bmi_chk(t)
elif ch==3:
print("BYE")
break
else: print("Invalid choice")
OUTPUT
Menu
1.Showing words having all 5 vowels
2.To check BMI
3.Exit
Enter your choice1
enter the number of words3
Enter a wordwharehousing
Enter a wordpandemonium
Enter a wordaugust
Words contain all 5 vowels are
wharehousing
pandemonium
Enter your choice2
enter the number entries3
Enter weight in Kg:45
Enterheight in meter:1.4
Enter weight in Kg:56
Enterheight in meter:1.6
Enter weight in Kg:75
Enterheight in meter:1.62
For the given height and weight (1.4, 45.0) Normal
For the given height and weight (1.6, 56.0) Normal
For the given height and weight (1.62, 75.0) Overweight
Enter your choice4
Invalid choice
Enter your choice3
BYE'''