Exemplo n.º 1
0
def main():
    print("Hello. Welcome to my weather app.")
    sleep(1.0)

    while True:
        user_choice = input(
            "Would you like to receive the weather at a city or an airport? Enter C for city and A for airport (or enter Q to quit): "
        )
        # Error check user input
        if (user_choice != "C") & (user_choice != "A") & (user_choice != "Q"):
            print("Error: Please enter either C for city or A for airport.")
        if user_choice == "C":
            city = input("Please enter a city name: ")
            api_call(city)
            print()
        if user_choice == "A":
            airport = input("Please enter an airport name: ")
            municipality = find_city(airport)
            api_call(municipality)
            print()
        if user_choice == "Q":
            sleep(1.0)
            print("Goodbye.")
            break
Exemplo n.º 2
0
def test_good_2():
    assert find_city("Lake Persimmon Airstrip") == "Lake Placid"
Exemplo n.º 3
0
def test_bad():
    assert find_city("Hello World") == 0
Exemplo n.º 4
0
def test_good_1():
    assert find_city("Pickles Airport") == "Berryville"
Exemplo n.º 5
0
def test_good_3():
    assert find_city("Spotts Field") == "Nora Springs"