Bryce H.

asked • 02/09/23

how to use debugger to fix code in this example?

Using a breakpoint and the debugger, find the problem and fix the following code:

patients = [[70, 1.8], [80, 1.9], [150, 1.7]]

def calculate_bmi(weight, height):
return weight / (height ** 2)

for patient in patients:
weight, height = patients[0]
bmi = calculate_bmi(height, weight)
print("Patient's BMI is: %f" % bmi)

The correct BMIs are 21.604938, 22.160665 and 51.903114.


1 Expert Answer

By:

Eva A. answered • 02/22/23

Tutor
5.0 (492)

Experienced Computer Science Teacher and Tutor

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.