Write a Python program to determine the shirt size of a user, based on the following.
· Input the Height and Weight of the user.
· Calculate the Ratio = Weight / Height
· Check, If Ratio is more than 7 and less than 17, Display “ Size XL”,
· Check, If Ratio is more than 5 and less than 7, Display “Size L”.
· Check, If Ratio is more than 3, and less than 5, Display “Size M”
· Otherwise Display “Size S”.
Answers
Given:
· Input the Height and Weight of the user.
· Calculate the Ratio = Weight / Height
· Check, If Ratio is more than 7 and less than 17, Display “ Size XL”
· Check, If Ratio is more than 5 and less than 7, Display “Size L”
· Check, If Ratio is more than 3, and less than 5, Display “Size M”
· Otherwise Display “Size S”.
To find:
Python program
Solution:
Program:
if __name__=="__main__":
weight = float(input("Enter your weight in pound (lbs): "))
height = float(input("Enter your height in inch (in): "))
bratio = weight/height
if bratio < 17 and bratio > 7:
print("Size XL")
elif bratio <7 and bratio>5:
print("Size L")
elif bratio <5 and bratio>3:
print("Size M")
else:
print("Size S")
Sample Output:
- Enter your weight: 198.416
- Enter your height: 62.9921
- Size S
Explanation:
- We enter the weight in terms of lbs
- We enter the height in terms of inches
- We are taking lbs and inches, so that we can display our output as per the range of ratio in the given data.
- The ratio is calculated as per the user input
- Then according to the ratio we are displaying the size
-----------------------------------------------------------------------------------------------
Also View:
Write a Python program to display age is greater than 18 or not
https://brainly.in/question/12150020
Write a Python program to find person is senior citizen or not input page
https://brainly.in/question/12150015
We count 35 heads and 94 legs among the chickens and rabbits in a ground. How many rabbits and how many chickens do we have? //this is an example for program . Write a python program to input heads count and legs count and print the count of rabbits and count of chickens. if the input is not suitable to print count of rabbits and count of chickens then the output should be "No solution".
https://brainly.in/question/10498755