2

I'm trying to make Scrabble in Python. The rack (where the 7 letters are) is a list where I appended 7 times tk.StringVar() Every time the player want to drop a word, I have to get the letters off the rack. Here's my problem. As I can associate the letters of the word dropped and the letters of the rack, I created a provisional list where I append each StringVar.get() from the initial rack. Then I created a code that change the dropped letters by an empty string '' as I can associate the initial rack with the provisional list. Here's my code

def defausse_rack_prov(word,rack_prov):
    word=word.get()
    for i in word:
        if i.upper() in rack_prov:
            rack_prov[rack_prov.index[i]]='' #This is the problematic line
    return rack_prov

I keep getting

TypeError: 'builtin_function_or_method' object is not subscriptable

What should I do ? Thank you :)

1 Answer 1

13

Should be .index(i) - parens, not brackets.

Sign up to request clarification or add additional context in comments.

1 Comment

Oups, it slipped through my fingers ! :) Thank you !

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.