Question

Using python, write a program that lets the user enter this information: First name & Last...

Using python, write a program that lets the user enter this information:

First name & Last name

weight

age

gender

height

systolic & diastolic blood pressure

body temperature in Fahrenheit

After the information has been entered, the results should be printed on the display based on the information below

-BMI

-Temp Conversion

-Mean blood pressure

-weight conversion (lbs to kg)

-height conversion (inches to cm)

The output should look like:

First Name Last name is ___ cm and ____kgs. First Name Last name has a BMI of ____, temperature of ____ degrees Celsius, and his or her mean blood pressure is ____ mmHG. Mr or Ms Last name is considered ____ (from government BMI standards) and he or she has normal/low/high blood pressure.

For references: normal BP is 120/80; low bp is less than 90/60; high bp is above 130/80

Underweight: less than 18.5

Normal BMIs: 18.5-25

Overweight: 25-30

Obese: 30+

The output should address the user by using mr or mrs and he or she

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

firstName=input("Enter First Name:")

lastName=input("Enter Last Name:")                         #All inputs

weight=int(input("Enter Weight in lbs:"))

age=int(input("Enter Age:"))

gender=input("Enter Gender:")

height=int(input("Enter height in inches:"))

systolicPressure=int(input(" Enter Systolic Pressure 120/80 - numerator:"))

diastolicPressure=int(input("Enter Diastolic Pressure 120/80 -denominator:"))

temp=int(input("Enter Body Temperature (F):"))

wtlbToKg=weight*0.4535   #1lb=0.4535 kg

htinToCm=height*2.54   #1inch=2.54 cm

tempFToC= (temp-32)*(5/9)

BMI= wtlbToKg/(pow((htinToCm/100),2))      #BMI= weight/height^2 ( kg/meters)

meanBP=((systolicPressure+(2*diastolicPressure))/3)   #Mean Blood pressure= sytolicpressure+2*diastolicPressure/3

if(gender=='M'):

    greet="Mr"

    greetStr="His"                         #greetins conversion

else:

    greet= "Mrs"

    greetStr="Her"

if(wtlbToKg<18.5):

    weightWord="Underweight"

elif(wtlbToKg>=25 and wtlbToKg<=30):                   #check for overweight

    weightWord="OverWeight"

elif(wtlbToKg>30):

    weightWord="Obese"

pressureWord="Normal bp"

if(systolicPressure>130 and diastolicPressure>80):                  #check for normal bp or high or low

    pressureWord="High bp"

elif(systolicPressure<90 and diastolicPressure<60):

    pressureWord="Low bp"

print('%s %s is %d cm and %f kgs. %s %s has a BMI of %f temperature of %f degree Celsius, and %s mean blood pressure is %f mmHG. %s %s is considered %s and %s has %s blood pressure.'%(firstName,lastName,htinToCm,wtlbToKg,firstName,lastName,BMI,tempFToC,greetStr,meanBP,greet,lastName,weightWord,greetStr,pressureWord))

Output:

Add a comment
Know the answer?
Add Answer to:
Using python, write a program that lets the user enter this information: First name & Last...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Java program that performs these operations Prompt the user to enter a low height...

    Write a Java program that performs these operations Prompt the user to enter a low height in feet (an integer) Prompt the user to enter a high height in feet (an integer) Prompt the user to enter a low weight in pounds (an integer) Prompt the user to enter a high weight in pounds (an integer) Print a table of Body Mass Index (BMI) for the heights and weights entered, ranging from the low height to the high height (inclusive),...

  • Write a function which asks users to enter names, heights, and weights of eachperson. For simplicity,...

    Write a function which asks users to enter names, heights, and weights of eachperson. For simplicity, let's assume names contain no white space - for example, justfirst names like John, Mike or Luke (so you can use cin >> name to get the name).Also assume height will range from 1.3 to 2.0 meters (which means if someoneenters a height that is less than 1.3 or greater than 2.0, show an error message andkeep asking user to enter them until they...

  • You are working as a software developer for a large insurance company. Your company is planning...

    You are working as a software developer for a large insurance company. Your company is planning to migrate the existing systems from Visual Basic to Java and this will require new calculations. You will be creating a program that calculates the insurance payment category based on the BMI score. Your Java program should perform the following things: Take the input from the user about the patient name, weight, birthdate, and height. Calculate Body Mass Index. Display person name and BMI...

  • A. Write a Python script so that the user can enter any number of grades. Create...

    A. Write a Python script so that the user can enter any number of grades. Create a calcavg() function so that it takes the number of grades as a parameter and returns the regular average (not a weighted average). You must loop through the grades for full credit. Add a try/except block so that if a non-numeric value is entered, you get the error message shown below. You cannot use lists. Input: c. python …\IT2430\FirstLastname\assign5-2.py 96.7 95.6 87.0 d. python...

  • Write a program that separately prompts the user for a first name and last name and...

    Write a program that separately prompts the user for a first name and last name and outputs a string containing the following information, in order: a. First letter of the user's name. b. First five letters of the user's last name. c. A random two-digit integer You must construct the desired string ensuring all characters are lowercase; output the identification string accordingly. Assume the last name contains at least 5 characters. You must use the Random (java.util.Random) class to generate...

  • Stat 50 Final Exam Last Name First Name 13. Consider the following paired data involving the...

    Stat 50 Final Exam Last Name First Name 13. Consider the following paired data involving the systolic and diastolic blood pressure readings. Systolic 1138 130|135|140|120|12511201130|13011441 143 11401130|15 Diastolic 82一91一100 100180 190ー80一80-80一98- 105-85- 70- 100 ] Diastolic 82 91 100 100 80 90 80 80 80 98 105 8570 100 (a) Does there appear to be a correlation between the systolic and diastolic blood pressure? (b) What is the regression line? (c) Find the best predicted diastolic blood pressure for a...

  • Write a program call FancyMyName which as the user for their first and last name and...

    Write a program call FancyMyName which as the user for their first and last name and print it like the example output bellow: Please enter your first name and last name, separated by a space? You entered the name: Louis Henry Output: LoUiS HeNrY (Code needed in Java) Thank You.

  • read instructions carefully please matlab only Write a MATLAB function for a BMI calculator that receives the inputs for body weight (lbs)and height (ft) from the user's program, calculates th...

    read instructions carefully please matlab only Write a MATLAB function for a BMI calculator that receives the inputs for body weight (lbs)and height (ft) from the user's program, calculates the BMI using the equation below, displays the BMI category, and outputs the BMI value tothe user's program W (kg) h2 (m2) BMI Display Normal if 18.5 s BMI 25 Display Overweight if 25 s BMI <30 Display Obese if BMI 2 30 Else display underweight So you will create two...

  • Using C++ cs 102 REVIEW LAB Selection a) Minimum/Maximum: Nrite a program that asks the user...

    Using C++ cs 102 REVIEW LAB Selection a) Minimum/Maximum: Nrite a program that asks the user to enter two numbers. The progzan should use the conditional operator to determine which number is the smaller and which is the larger. Display your output in the format below: The smaller number is: (smallerNumber) The larger number is: ClargerNumber] b) Areas of Rectangles: The area of a rectangle is calculated by maltiplying its length tines its width. Write a program that asks the...

  • For this task, you will be writing a Python script that will determine a person’s blood...

    For this task, you will be writing a Python script that will determine a person’s blood pressure category. The program should prompt the user for the systolic and diastolic blood pressure readings. Based on the readings and using the table below, the program will determine and output the category. Category Systolic Diastolic Hypotension 50-89 35-59 Normal 90-119 60-79 Pre-hypertension 120-139 80-89 Mild Hypertension 140-159 90-99 Moderate Hypertension 160-179 100-109 Severe Hypertension 180-209 110-119 Very Severe Hypertension 210-239 120-135    Other...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT