0% found this document useful (0 votes)
3 views1 page

Class 9 Programs.

The document contains three Python functions: one to find unique elements in a list, another to count the number of vowels in a given string, and a third to calculate BMI and categorize weight status. The unique_list function iterates through a list to create a new list of unique items. The BMI_scale function uses user input for weight and height to determine and print the weight category based on BMI.
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)
3 views1 page

Class 9 Programs.

The document contains three Python functions: one to find unique elements in a list, another to count the number of vowels in a given string, and a third to calculate BMI and categorize weight status. The unique_list function iterates through a list to create a new list of unique items. The BMI_scale function uses user input for weight and height to determine and print the weight category based on BMI.
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

#find unique elements from a list:

def unique_list(list):
result = []

for item in list:


if item not in result:
[Link](item)

return result

lst = [1, 2, 3, 2, 5, 3, 1, 9]
print(unique_list(lst))

#Count the number of vowels:

def vowel_count(str):
count = 0
vowel = list("aeiouAEIOU")

for alphabet in str:


if alphabet in vowel:
count += 1

return count

str = "The Quick Brown Fox Jumps Over The Lazy Dog"
print("No. of vowels in given String is: ",vowel_count(str))

#BMI Calculater

def BMI_calculater(weight, height):


return weight/(height/100)**2 # BMI = weight(kg) /
Hight(m)^2

def BMI_scale(weight, height):


index = BMI_calculater(weight, height)

if index < 18.5:


print("The person is UNDER WEIGHT")
elif index < 24.9:
print("The person is HEALTHY")
elif index < 30:
print("The person is OVER WEIGHT")
else:
print("The person is OBESITY")

weight = float(input("Enter your Weight(KG): "))


height = float(input("Enter your Height(Cm): "))

BMI_scale(weight, height)

You might also like