def generate_game_url(season, season_segment, game_number):

    """
    Generates the url for a particular nhl game. The url is a concatenation
    of the year, season type, and game number.

    Inputs:
    :param season: the year in which the season started
    :param season_segment: 1 = preseason, 2 = regular season, 3 = playoffs
    :param game_number:
    :return: tuple containing the game code (i.e. segment of the url coding for the particular game) and the url
    """

    ## the game code is just a concatenation of the year (in which the season started)
    ## the season segment (zero padded to len 2, 0 = preseason, 1 = regular, 2 = playoffs),
    ## and the game number (zero padded to len 4)
    game_code = str(season) + str(season_segment).zfill(2) + str(game_number).zfill(4)
    game_url = f"https://statsapi.web.nhl.com/api/v1/game/{game_code}/feed/live"

    return game_code, game_url