def setup_ship(self, name, length): while True : print("Add a " + name + " (length {0}):".format(length)) start = input("Enter a start coordinate : ") end = input("Enter the end coordinate: ") ship = Ship(Coord(start), Coord(end)) if ship.length() != length : print("That's not the right length ({0}). Try again.".format(ship.length())) else : break self._my_board.add_ship(ship)