0

Iteration? For loop? Nested dictionary?

Not sure how to code in such a way that I can use the values in the dictionary into my x and y ... The x and y are the weight and height respectively Below is what I have written so far: bmi = {'a':[75, 1.72], 'b':[60, 1.57], 'c':[82, 1.93]} def calculate_bmi(x,y): return x/squares(y) def squares(y): return y**2 # I know that to get the values of the dictionary I can do this for k in bmi.values(): But I don’t know how to move further

1st Nov 2018, 12:39 PM
Nah Wei Siang
Nah Wei Siang - avatar
4 odpowiedzi
+ 1
Please check again. Is that what you wanted?
1st Nov 2018, 2:11 PM
Udi Finkelstein
Udi Finkelstein - avatar
1st Nov 2018, 1:04 PM
Udi Finkelstein
Udi Finkelstein - avatar
0
thanks but how do i code it such that when i input calculate_bmi it will take in the values ?
1st Nov 2018, 1:08 PM
Nah Wei Siang
Nah Wei Siang - avatar
0
thanks a lot Udi for the help(:
1st Nov 2018, 2:18 PM
Nah Wei Siang
Nah Wei Siang - avatar