Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8035293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:16:11+00:00 2026-06-05T02:16:11+00:00

turns = [4, 6, 2, 8, 1, 9, 5, 5, 3, 7, 6, 8,

  • 0
turns = [4, 6, 2, 8, 1, 9, 5, 5, 3, 7, 6, 8, 2, 4]
turns.append([1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4])
turns.append([4, 6, 2, 8, 1, 9, 6, 5, 3, 7, 6, 8, 2, 4]) 
turns.append([0, 0, 26, 24, 3, 7, 5, 4, 25, 25, 21, 21, 21, 21])
turns.append([0, 0, 0, 0, 7, 3, 8, 2, 0, 0, 29, 29, 29, 29])
turns.append([0, 0, 0, 0, 26, 24, 0, 0, 0, 0, 0, 0, 0, 0])

arrayValue = turns[j][i]
    if arrayValue == turnCurrently:

Error Message:
Traceback (most recent call last):
  File "D:/a45d32f947055690c690d94f88/TicTacToe", line 183, in <module>
    arrayValue = turns[j][i]
TypeError: 'int' object is not subscriptable

My question is essentially, I want to test if turns[j][i] is equal to turnCurrently but I keep running into this subscriptable problem, I haven’t been able to find this answered anywhere I think that this is a very important question. Thanks in advance,
Richard

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:16:13+00:00Added an answer on June 5, 2026 at 2:16 am

    It often helps a lot to print out the content of your variables to see what it happening:

    >>> turns
    [4, 6, 2, 8, 1, 9, 5, 5, 3, 7, 6, 8, 2, 4, [1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4], [0, 0, 26, 24, 3, 7, 5, 4, 25, 25, 21, 21, 21, 21], [0, 0, 0, 0, 7, 3, 8, 2, 0, 0, 29, 29, 29, 29], [0, 0, 0, 0, 26, 24, 0, 0, 0, 0, 0, 0, 0, 0]]
    

    As you can see, the first few elements of that list are simple integers, but not a list of ints. So when j is small, it will select an int and try to apply [i] on it – which fails.

    The solution in this case is to put the first elements into an extra list:

    turns = [[4, 6, 2, 8, 1, 9, 5, 5, 3, 7, 6, 8, 2, 4]]
    turns.append( … )
    

    Another way would be to initialize your list as an empty list, and append the first sub-list as well:

    turns = []
    turns.append([4, 6, 2, 8, 1, 9, 5, 5, 3, 7, 6, 8, 2, 4])
    turns.append( … )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It turns out that in order to do this one has to bind the
Update: Turns out this is undocumented behaviour of the NetStream class - NetStream loads
It turns out our slaves spend a considerable amount of time moving the archived
Edit: It turns out I missed something obvious, but I'm going to leave the
could MPMusicPlayerController turns off volume at once ?
UPDATE: As it turns out, the below is caused by a caching issue on
Solution Edit: Turns out you can't use the PHP SDK to return the correct
I wrote a small app that turns out to be using a lot of
Please tell me which code or process turns a gridview links into a format
I really love SyntaxHighter - it turns out the poshest looking code around. Unfortunately

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.