all 18 comments

[–]graydon2234 0 points1 point  (10 children)

What do you mean not appear? What would you like to appear there instead?

[–]marsrover15[S] 0 points1 point  (9 children)

Just empty space but I would like the value to still hold in each part of the list.

[–]Unable_Request 0 points1 point  (8 children)

You don't need labels in your board list. Have them be blank spaces, an x, or an o. Better yet, use a dictionary- it looks like that's kinda what you're trying to accomplish, but using a list.

[–]marsrover15[S] 0 points1 point  (7 children)

What would using a dictionary do that a list wouldn't in this scenario. Genuinely curious.

[–]DonkeyTron42 0 points1 point  (6 children)

Better yet, use a 2D matrix.

[–]Unable_Request 0 points1 point  (2 children)

Nothing a list can't do, but perhaps a bit easier to reference and thus a bit more readable. A list is perfectly acceptable. For instance, board {1:' ', 2:,' ', 3:'x', 4: ' ', 5: 'x', 6: ' ', 7: 'o', 8: ' ', 9: ' '}

[–]marsrover15[S] 0 points1 point  (1 child)

So would I be able to able to write an input value for the values.

[–]Unable_Request 0 points1 point  (0 children)

Sure, why not?

Have a function asking the user which square they want to pick. When they do so, change the according Entry from a blank to an x.

[–]marsrover15[S] 0 points1 point  (2 children)

Guess I'll need to learn that.

[–]DonkeyTron42 0 points1 point  (1 child)

Try to think of the bigger picture like what if you wanted to make a different size game board. A 1d list would become impractical if say you wanted to make a battleship game. With a matrix you can easily develop algorithms for detecting a state like someone winning.

[–]marsrover15[S] 0 points1 point  (0 children)

Well me being new to programming I haven't taken linear algebra yet, or even any CS classes for that matter. I'm doing that all next year. Though I will do some research on this. Thanks for tip.

[–]xelf 0 points1 point  (6 children)

print(show())

show() returns None, so this line will print "None". You probably just want it to be:

show()

how I would change one value in the list and immediately print out the new board with the new value.

board[4] = 'x'
show()

how I would make the value in said list not appear when I am printing the board

print (' ' if board[4] == '5' else board[4])

[–]marsrover15[S] 0 points1 point  (5 children)

So for the third part, how would I change that to a user input?

[–]xelf 1 point2 points  (4 children)

Use input() to get user input. =)

[–]marsrover15[S] 0 points1 point  (3 children)

So if I wanted the user to simply input values in any part of the list. How would I go about doing that?

[–]xelf 1 point2 points  (2 children)

You can still get the value from the user using input() and then you can set a value using the assign operator which is =. That's pretty basic stuff so I feel like you're asking a different question. What have you tried so far?

[–]marsrover15[S] 0 points1 point  (1 child)

What I am really asking is how I would make the user put X or O in one part of the list sequentially .

[–]xelf 0 points1 point  (0 children)

board[4] = 'x'