0
def readscorefromcsv():
    position = listusers.index(username)

    print(position)

    global pointposition
    pointposition = listscore(int(position))

I keep getting the error TypeError: 'list' object is not callable

I am trying to find the value for a specific position in an array

  • listusers is an array of usernames, listscore is the array of user scores.
  • position is the position of the username in the array.
1
  • What you're calling an "array" is called a list in Python. Commented Aug 26, 2017 at 15:25

2 Answers 2

3

List elements can be accessed by [] . listscore() means, calling the method named listscore

 pointposition = listscore[int(position)]
Sign up to request clarification or add additional context in comments.

Comments

0

listscore is a list, by doing listscore() you get the error TypeError: 'list' object is not callable. Use [] instead to access an item. And index() returns an integer, so you don't need to call int(). Try this:

pointposition = listscore[position]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.