Python Forum

Full Version: IndentationError: expected an indented block
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
class Player:
    def __init__(self):
        self.inventory = [items.RedBloodCell()]
        self.hp = 100
        self.location_x, self.location_y = world.starting_position
        self.vicory = false

    def is_alive(self):
        return self.hp > 0

    def print_inventory(self):
        for item in self.inventory:

    def move(self, dx, dy):
        self.location_x += dx
        self.location_y += dy
        print(world.tile_exists(self.location_x, self.location_y).intro_text())
IndentationError: expected an indented block on Line 14
you have for loop on line 12, but there is no loop body.

def print_inventory(self):
    for item in self.inventory:
        print(item) # this is just an example, you need to do something in the loop body
If you are not yet ready to write the code for printing the inventory you can always put pass on line 13.