def pkg_update(): """Update pip packages.""" while True: options = ["Yes", "Exit"] add_numbers(options) choice = input("Check for updates? ") if choice in "1": print("Checking for updates.") run("pip-review --local --interactive", check=True) else: exit(0)
def cloud_main(): """Explore the clouds.""" cloud_choices = ["View clouds", "Cloud information"] add_numbers(cloud_choices) choice = int(input("Choose an option. ")) if choice == 1: view_clouds() elif choice == 2: get_cloud_information() else: print("Please enter a number.") main()
def porch(): """porch""" while True: porch_options = ["Front", "Exit"] add_numbers(porch_options) porch_choice = input("Choose an option. ") if porch_choice in "1": living_room() elif porch_choice in "2": sys.exit(0) else: print("Invalid answer!")
def make_menu(): """ Make a list of menu items. """ trend_options = ["Rising", "Falling", "Steady"] menu = add_numbers(trend_options) return menu
def main(): """Prompt user to choose from list.""" while True: weather_options = [ "Convert to Celsius", "Convert to Fahrenheit", "Find dew point", "Find cloud ceiling", "Convert knots to MPH", "Cloud types", "Beaufort scale", "Forcast", "Convert pressure", "Exit", ] add_numbers(weather_options) choice_dic = { 1: to_celsius, 2: to_fahrenheit, 3: find_dew_point, 4: find_base, 5: wind, 6: cloud_main, 7: scale_wind, 8: get_forecast, 9: convert_millibars, } try: weather_choice = int(input("\nChoose an option. ")) if weather_choice == 10: sys.exit(0) elif weather_choice > 10: print("Please enter correct number.") else: choice_dic[weather_choice]() except (ValueError, KeyError): print("Please enter a number.") main()
def basement(): """basement""" while True: laundry_option = ["Yes", "No"] add_numbers(laundry_option) laundry = input("Do you want to do laundry? ") if laundry in "1": quarters = int(input("How many quarters do you have? ")) if quarters < 8: print(f"{quarters} is not enough money.") elif quarters >= 8: print("Washing!") sleep(3) print("Drying!") sleep(6) print("Done!") else: living_room()
def living_room(): """living_room""" while True: room_select = [ "Kitchen", "Stairs", "Porch", "Basement", "Browse", "Rest", "Weather", ] add_numbers(room_select) room_choice = input("""\nThis is the living room. \rChoose a room or activity. """) if room_choice in "1": kitchen() elif room_choice in "2": stairs() elif room_choice in "3": porch() elif room_choice in "4": basement() elif room_choice in "5": get_web_site(room_choice) elif room_choice in "6": count(room_choice) else: print("Invalid Answer.")
def make_menu(): """Make a menu of cloud types.""" cloud_types = ["Cumulus", "Stratus", "Cumulonimbus", "Cirrus"] menu = add_numbers(cloud_types) return menu