435,156 Members | 1,069 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,156 IT Pros & Developers. It's quick & easy.

# I can't get my simple Body Mass Index calculator to work

 P: 2 I am very new to python and I just want to write a simple program that calculates BMI using a simple function with arguments...It just tells me that my first "height" syntax is wrong. Help please :) Expand|Select|Wrap|Line Numbers   # This program calculates a person's Body Mass Index   def main():     intro()     weight = input(int('What is your weight in pounds? ')     height = input(float('What is your height in inches? ')     print('Your BMI or Body Mass Index is: ')     bmi(weight, height)   def intro():     print('This program calculates your Body Mass Index')     print('which helps you determine if you are at a healthy weight')     print('Underweight is below 18.5')     print('Healthy weight is 18.5 to 24.9')     print('Overweight is 25 to 29.9')     print('Obese is above 30')   def bmi(weight, height):     bmi = weight * 703 / height**2     print(bmi)   main()     Feb 16 '14 #1

#### ✓ answered by bvdet

You are missing a closing parenthesis on lines 6 and 7. After adding the parentheses, the script will fail on the int and float calls. Move those calls outside of the input argument. I also suggest naming the bmi function to something like bmi_calc to avoid confusion with the local variable bmi used inside the function scope.

2 Replies

 Expert Mod 2.5K+ P: 2,851 You are missing a closing parenthesis on lines 6 and 7. After adding the parentheses, the script will fail on the int and float calls. Move those calls outside of the input argument. I also suggest naming the bmi function to something like bmi_calc to avoid confusion with the local variable bmi used inside the function scope. Feb 16 '14 #2

 P: 2 Thank you so much! This helps me out!! I knew I was in the right direction. :) Feb 16 '14 #3