Arnie R.

asked • 07/23/18

Question about Python functions

In the abbreviated code below, how do the upper pairs relate to the function below them?  Thank you.
 
height_m3 = 2.5
name3 = "Mary"
weight_kg3 = 160

def bmi_calculator(name, height_m, weight_kg):
bmi = weight_kg / (height_m ** 2)
print("bmi: ")

Avishkar T.

Hy Arnie R. , Python function is a set of statements that take inputs, do some specific computation and produces output. It may or may not return value. In your question you have defined a function named bmi_calculator which takes three parameters name, height_m and weight_kg. Also you have declared height_m3 , name3 and weight_kg3 with the values 2.5, Mary and 260 respectively. You can call the function bmf with the syntax bmi( height_m3,name3,weight_kg3) weight_kg / (height_m ** 2) is performed and then assigned to bmi. which is then printed out. I hope you understood. Let me know if you have any questions.
Report

11/08/19

1 Expert Answer

By:

Matthew B. answered • 11/13/19

Tutor
5.0 (62)

Founder, CEO, and Lead Developer: Apteryx Labs | Stanford, 2015

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.