0

I try to run the code:

for c in range(10, 21):
    print(c)
    print([c[1]])

And I get the error: TypeError: 'int' object is not callable Why? How can I pick a specific element from an integer?

Loocid
  • 6,112
  • 1
  • 24
  • 42

1 Answers1

-1

you are iterating in an iterable, you need to declare before the list to access to the element something like this:

a = range(10,21)
for i in a:
    print(i)
    print(a[1])

In your code every iteration the value of c are: 10 11 12 13 ... This is the reason of you error