1

Here is the code that causes the error in coordinate init:

self.estate = "x"

def set_estate(self, estate):
    self.estate = estate

    self.table[coordinate_line][coordinate_column].set_estate("!") 

I get this error:

list indices must be integers or slices, not str
Pika Supports Ukraine
  • 3,612
  • 10
  • 26
  • 42
  • Welcome the StackOverflow. Please properly indent your code and format your question, providing the full error trace as well as parts of your missing code. – Vasilis G. Dec 17 '18 at 19:14
  • print `coordinate_line` and `coordinate_column`, check that they are both integers – Tarifazo Dec 17 '18 at 19:15
  • Welcome to StackOverflow. Unfortunately, your code and your question are not clear. Please read and follow [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). Make sure your code is self-contained and can run (or start to run) as shown. Show the entire traceback that comes from that code. – Rory Daulton Dec 17 '18 at 19:19
  • yes they correspond at what i choose – Carlos Cerro Dec 17 '18 at 19:19

1 Answers1

0

This exception occurs when you try to access a value in a list using something other than an integer or slice. This would mean that the data type of either coordinate_line or coordinate_column is not an integer or slice. This works with values you can convert to an int:

self.table[int(coordinate_line)][int(coordinate_column)].set_estate("!")
Pika Supports Ukraine
  • 3,612
  • 10
  • 26
  • 42