0% found this document useful (0 votes)
3 views4 pages

Height and Weight Guidance Program

The document is a Python script that calculates the average weight range based on user-inputted height and provides dietary and exercise suggestions based on whether the user is underweight or overweight. It includes functions for determining weight ranges, suggesting foods, and recommending exercises. The script also allows users to continue or terminate the program based on their preference.

Uploaded by

yara.nasim21
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Height and Weight Guidance Program

The document is a Python script that calculates the average weight range based on user-inputted height and provides dietary and exercise suggestions based on whether the user is underweight or overweight. It includes functions for determining weight ranges, suggesting foods, and recommending exercises. The script also allows users to continue or terminate the program based on their preference.

Uploaded by

yara.nasim21
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

height = int(input("Enter your height in centimeters please:"))

# user inputs their height

weight = int(input("Enter your weight in kilograms please:"))

# user inputs their weight

def height_cm(height):

#this function decides in which range your weight should be depending on


the user input on height

if height >= 137 and height < 140:

print("your average weight should be between 28.5 and 34.9 kg")

elif height >= 140 and height <142:

print("your average weight should be between 30.8 and 37.6 kg")

elif height >= 142 and height <145:

print("your average weight should be between 32.6 and 39.9 kg")

elif height >= 145 and height <147:

print("your average weight should be between 34.9 and 42.6 kg")

elif height >= 147 and height <150:

print("your average weight should be between 30.8 and 38.1 kg")

elif height >= 150 and height <152:

print("your average weight should be between 39.0 and 47.6 kg")

elif height >= 152 and height <155:

print("your average weight should be between 40.8 and 49.9 kg")

elif height >= 155 and height <157:

print("your average weight should be between 43.1 and 52.6 kg")

elif height >= 157 and height <160:

print("your average weight should be between 44.9 and 54.9 kg")

elif height >= 160 and height <163:

print("your average weight should be between 47.2 and 57.6 kg")


elif height >= 163 and height <165:

print("your average weight should be between 49.0 and 59.9 kg")

elif height >= 165 and height <168:

print("your average weight should be between 51.2 and 62.6 kg")

elif height >= 168 and height <170:

print("your average weight should be between 53.0 and 64.8 kg")

elif height >= 170 and height <173:

print("your average weight should be between 55.3 and 67.6 kg")

elif height >= 173 and height <175:

print("your average weight should be between 57.1 and 69.8 kg")

elif height >= 175 and height <178:

print("your average weight should be between 59.4 and 72.6 kg")

elif height >= 178 and height < 180:

print("your average weight should be between 61.2 and 74.8 kg")

elif height >= 180 and height <183:

print("your average weight should be between 63.5 and 77.5 kg")

elif height >= 183 and height <187:

print("your average weight should be between 65.3 and 79.8 kg")

height_cm(height)

# calling the function

c = input("do you want to continue? (yes/no): ")

#asks user if she want to continue or not

if c == "yes":

# code will keep running and continue


food = input("are you underweight or overweight? ")

#user inputs if she is underweight or overweight

print(food)

else:

print ("Take care of your well-being! Byee!")# code will end/terminate

if food == "overweight":

print("You can start eating fruits and cut junk food out.")

#will be printed if user inputs overweight

else:

print("go to the gym and build muscle to gain weight, eat and more
protein.")

#will be printed if user inputs underweight

def food_suggestions(weight):

# a new function is created depending on the weight

if weight == "overweight":

# user input

low_fatfood = ["apples", "orange", "grapefruits", "kiwis", "mangos",


"berries", "strawberry", "melons", "low fat bread",]

print("Here are some low fat foods you can eat lose weight and
maintain a healthier body:")

for low_fatfood in low_fatfood:

print(low_fatfood)

#list containing low fat foods will be printed

elif weight == "underweight":

# user input
high_fatfood = ["avocado", "nuts", "seeds", "whole grains", "legumes",
"meat", "dairy products", "dried fruits"]

print("Here are some foods you can eat to help gain weight:")

for high_fatfood in high_fatfood:

print(high_fatfood)

#list containing high fat foods will be printed

food_suggestions(food)

def exercise(weight, height):

if weight == "overweight":

return "You can start going to the gym and build muscle by using the
machine and increase the weights as well as maintaining a good diet"

elif weight == "underweight":

return "You can start by also going to the gym and replacing the fat with
muscle as well as you can do sports like swimming, running, and maintaining
a proper diet"

print(exercise(food, height))

You might also like