from datetime import datetime


def get_url(country, age, gender):
    """Construct URL based on input"""
    country = country.title()
    date = datetime.today().strftime("%Y-%m-%d")
    url_part1 = "https://d6wn6bmjj722w.cloudfront.net/1.0/life-expectancy/remaining/"
    url_part2 = f"{gender}/{country}/{date}/{age}y/?format=json"
    return url_part1 + url_part2