I have an array set out like this:
['age', 'height', 'weight']
and I need to "fill" the array with values from a list which contains objects with the values age, height and weight.
For example:
for value in list:
age = value.age
height = value.height
weight = value.weight
"[{}, {}m, {}lb]".format(age, height, weight)
and I would like to get the desired output:
[21, 1.77m, 160lb]
[25, 1.56m, 145lb]
etc for each object in the list.
So the final output would end up being like this:
['age', 'height', 'weight']
[21, 1.77m, 160lb]
[25, 1.56m, 145lb]
"[{}, {}m, {}lb]".format(age, height, weight)? You're calculating the format, but you don't seem to be doing anything with it (assigning it to a variable, printing it to screen, etc.).forloop, and append to it on each iteration.