See commented corrected code below
class Hex: # should be lower cass class def __init__(self, x, y): # indent 4 spaces not 2 self.x = x # indent another 4 spaces inside of the def self.y = y # indent another 4 spaces inside of the def hex_map = [[Hex(i, j) for j in range(1, 10)] for i in range(1, 10)] # should not be indent here