Esempio n. 1
0
def tellMetros(network):

    while True:

        for metro in network.metros.items():
            print(metro[1].code + " " + metro[1].name)
        code = raw_input("Would you like the details of a city? Enter its code to display.")
        code = code.upper()
        try:
            metro = network.metros[code]
        except:
            print("You must enter a valid code of the city.")
            continue

        print(metro.name + " " + metro.country + " " + metro.continent)
        print("GMT: " + str(metro.timezone))

        print("Coordinates:"),
        for coordi in metro.coordinates.items():
            print(coordi[0] + ": " + str(coordi[1])),

        print("Population: " + str(metro.population))
        print("Region: " + str(metro.region))

        if TellerHelpers.endTelling():
            return
Esempio n. 2
0
def tellFacts(network):
    while True:

        print("1. What is the longest single flight in the network?\n"
              "2. What is the shortest single flight in the network?\n"
              "3. What is the average distance of all the flights in the network?\n"
              "4. What is the biggest city (by population) served by CSAir?\n"
              "5. What is the smallest city (by population) served by CSAir?\n"
              "6. What is the average size (by population) of all cities served by CSAir?\n"
              "7. A list of continents served by CSAir and cities in them.\n"
              "8. A list of Hub Cities")

        factNumber = raw_input("What would you like to know about us?")
        try:
            dispatch[factNumber](network)
        except ValueError:
            print("\nPlease Enter a number between 1 and 8.\n")
            continue

        if TellerHelpers.endTelling():
            return