Example #1
0
def find_locations():
    print("********* All cities in database ********* ")
    all_cities = data_service.get_all_cities()

    for idx, c in enumerate(all_cities, start=1):
        print(f"{idx}. {c}")
    chose_it = try_int(input("Choose city by typing its number: ")) - 1

    if not (0 <= chose_it < len(all_cities)):
        print("Error. Pick another number")
        return

    city = all_cities[chose_it]
    all_city_locations = data_service.get_locations_by_city(city)

    loc_term = 'location'
    if len(all_city_locations) != 1:
        loc_term += 's'

    print()
    print(f"{len(all_city_locations)} {loc_term} in this city")
    print()
    for c in all_city_locations:
        print(
            f"* {c.org} {c.space} - {c.city} {c.country}, "
            f"{c.standing_capacity} standing spaces. Height: {c.height_in}in")
    print()
    return all_city_locations
Example #2
0
def rent_a_scooter():
    print("********* Rent a scooter ********* ")
    scooters = find_available_scooters(True)
    chose_it = try_int(input('Which one do you want? ')) - 1

    if not (0 <= chose_it or chose_it < len(scooters)):
        print("Error: Pick another number.")
        return

    scooter = scooters[chose_it]