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
4 Antworten
+ 1
Please check again. Is that what you wanted?
0
thanks but how do i code it such that when i input
calculate_bmi
it will take in the values ?
0
thanks a lot Udi for the help(: