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

Asked 2 years ago, Updated 2 years ago, 38 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


© 2024 OneMinuteCode. All rights reserved.