[Solved] How do i print out number variables in python 3? [closed]


The main problem here is that you are calling functions as they were variables

Here is your code with the functions being called correctly:

import math

print('input your height and weight to find BMI.')

num_a = int(input("feet=="))
num_b = int(input("inches=="))
num_c = int(input("weight(lbs)=="))

def weight():
    return int(num_c) * 2.2

def height():
    return (int(num_a)) * 12 + int(num_b)

def height_meters():
    return (int(height())) * 0.0254

def height_meters_sq():
    return math.sqrt(int(height_meters()))

def bmi():
    return (int(weight())) / int(height_meters_sq())

print("Your BMI is..")
print(bmi())

The result:

input your height and weight to find BMI.
feet==10
inches==5
weight(lbs)==10
Your BMI is..
22.0

The other problem in your code, is that your functions where not returning the values. In python, the default return value from a function is None (null), so if you don’t return the value, when you print the bmi(), it will simply print None

0

solved How do i print out number variables in python 3? [closed]