TypeError: unsupported operation type(s) for -: Why does 'list' and 'int' appear so much?

Asked 1 weeks ago, Updated 1 weeks ago, 0 views

 key = list (range (150, 180, 3))
Standard weight = (height - 100) * 0.9
for i in range(10):
    print (i + 1, height [i], "cm", standard weight, "kg")

![Image][1]

[1]: https://res.cloudinary.com/eightcruz/image/upload/v1622874501/hnjzv3jscdcdznyhjtqr.png

list python

2022-09-20 15:56

1 Answers

Because the "key" is in the form of a list You have to extract each element from the key list.

 key = list (range (150, 180, 3))
for i in range(10):

    Standard weight = (height[i] - 100) * 0.9
    print (i + 1, height [i], "cm", standard weight, "kg")


2022-09-20 15:56

If you have any answers or tips


© 2022 pinfo. All rights reserved.