def insert_position(player, ship, starting):
    """Insert a valid position (e.g. B2)."""
    while True:
        if starting:
            position = input(player.name +  ", where do you want to place your " + ship[0] + "(" + str(ship[1]) + ")? ").upper()
        else:
            position = input(player.name +  ", where do you want to shoot? ").upper()
        try:
            if (position[0] in ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']) and (int(position[1:]) in range(1, 11)):
                return position
            else:
                print("Please insert a valid position.\n")
        except:
            print("Please insert a valid position.\n")