def make_bicycle(models): print "Choose a model from list of models: " names = map(lambda model: model.name, models.itervalues()) _, name = choose_one_from_list(names) print "Choose color from selection of colors for model", name, ":" _, color = choose_one_from_list(models[name].colors) _, size = choose_one_from_list(models[name].sizes.keys()) s = "How many Bicycles to manufacture of\t" s += "MODEL: \t{} \t COLOR: \t{} \tSIZE: \t{}?" print s.format(name, color, size) quantity = positive_int_input("Type Quantity: ") bicycles = [] for i in range(quantity): bicycles.append(Bicycle(name, color, size)) return bicycles
def bicycle_production(bicycles, models, company_inventory): print("Choose a model from list of models: ") names = list(map(lambda model: model.name, models.values())) _, name = choose_one_from_list(names) print("Choose color from selection of colors for model", name, ":") _, color = choose_one_from_list(models[name].colors) _, size = choose_one_from_list(list(sorted(models[name].sizes.keys()))) s = "How many Bicycles to manufacture of\t" s += "MODEL: \t{} \t COLOR: \t{} \tSIZE: \t{}?" print(s.format(name, color, size)) quantity = positive_int_input("Type Quantity: ") global count for i in range(quantity): ide = count bicycles[ide] = Bicycle(ide, name, color, size, company_inventory) count += 1
def bicycle_production(bicycles, models, company_inventory): print ("Choose a model from list of models: ") names = list(map(lambda model: model.name, models.values())) _, name = choose_one_from_list(names) print ("Choose color from selection of colors for model", name, ":") _, color = choose_one_from_list(models[name].colors) _, size = choose_one_from_list(list(sorted(models[name].sizes.keys()))) s = "How many Bicycles to manufacture of\t" s += "MODEL: \t{} \t COLOR: \t{} \tSIZE: \t{}?" print (s.format(name, color, size)) quantity = positive_int_input("Type Quantity: ") global count for i in range(quantity): ide=count bicycles[ide]=Bicycle(ide, name, color, size, company_inventory) count+=1
def main(): CATEGORIES = ["Mountain", "City", "HighWay"] SIZES = ["XSmall", "Small", "Medium", "Large", "XLarge", "XXLarge"] COLORS = [ "White", "Yellow", "Green", "Blue", "Red", "Brown", "Purple", "Gray", "Black" ] models = {} bicycles = {} company_inventory = [] print("\nWelcome to Bicycle Industry Model.") print("\nLets start with creating bicycle models.") choice1, _ = choose_one_from_list( ["Let's create some models!", "Use sample model library"]) if choice1 == 1: sample_model_library(models) else: make_models(models, CATEGORIES, COLORS, SIZES) print_bicycle_models(models) print("Lets create some bicycles.") shortcut = False if choice1 == 1: choice2, _ = choose_one_from_list( ["Let's create some Bicycles!", "Use sample bicycle library"]) if choice2 == 1: shortcut = True if shortcut: sample_bicycle_library(bicycles, company_inventory) else: make_bicycles(bicycles, models, company_inventory) print_bicycles(bicycles)
def main(): CATEGORIES = ["Mountain", "City", "HighWay"] SIZES = ["XSmall", "Small", "Medium", "Large", "XLarge", "XXLarge"] COLORS = ["White", "Yellow", "Green", "Blue", "Red", "Brown", "Purple", "Gray", "Black"] models={} bicycles = {} company_inventory = [] print ("\nWelcome to Bicycle Industry Model.") print ("\nLets start with creating bicycle models.") choice1, _ = choose_one_from_list( ["Let's create some models!", "Use sample model library"] ) if choice1 == 1: sample_model_library(models) else: make_models(models, CATEGORIES, COLORS, SIZES) print_bicycle_models(models) print ("Lets create some bicycles.") shortcut=False if choice1==1: choice2, _ = choose_one_from_list( ["Let's create some Bicycles!", "Use sample bicycle library"] ) if choice2==1: shortcut=True if shortcut: sample_bicycle_library(bicycles, company_inventory) else: make_bicycles(bicycles, models, company_inventory) print_bicycles(bicycles)
def main(): print "\nWelcome to Bicycle Industry model." print "\nLets start with creating bicycle models." choice, _ = choose_one_from_list(["Let's create some models!", "Use sample model library"]) if choice == 0: models = make_models() elif choice == 1: models = sample_model_library() for name, model in models.iteritems(): print model print "\nLets create some bicycles" bicycles = make_bicycles(models) for bicycle in bicycles: print (bicycle) print "\nLets open some shops"
def make_model(models, CATEGORIES, COLORS, SIZES): name = text_input("Model name: ") print("Choose a category: ") _, category = choose_one_from_list(CATEGORIES) description = text_input("Description: ") print("Add color options:") colors = choose_many_from_list(COLORS) print("Add size options:") # This includes size selection, and additional info for each size size_lst = choose_many_from_list(SIZES) sizes = {x: {} for x in size_lst} for size in size_lst: print("\nMODEL:\t{}\tSIZE:\t{}".format(name, size)) sizes[size]['weight'] = positive_float_input("Enter weight (Kg): ") sizes[size]['price'] = positive_float_input("Enter cost (US $): ") print models[name] = Model(name, category, description, colors, sizes)
def make_model(): name = text_input("Model name: ") print "Choose a category:" _, category = choose_one_from_list(CATEGORIES) description = text_input("Description: ", True) print "Add color options:" colors = choose_many_from_list(COLORS) colors = [x for _, x in colors] print "Add size options:" # This includes size selection, and additional info for each size sizes = choose_many_from_list(SIZES) sizes = {x: {} for _, x in sizes} for size, details in sizes.iteritems(): print "\nMODEL:\t{}\tSIZE:\t{}".format(name, size) details["weight"] = positive_int_input("Enter weight (Kg): ") details["price"] = positive_int_input("Enter cost (US $): ") return Model(name, category, description, colors, sizes)
def make_model(models, CATEGORIES, COLORS, SIZES): name = text_input("Model name: ") print ("Choose a category: ") _, category = choose_one_from_list(CATEGORIES) description = text_input("Description: ") print ("Add color options:") colors = choose_many_from_list(COLORS) print ("Add size options:") # This includes size selection, and additional info for each size size_lst = choose_many_from_list(SIZES) sizes = {x: {} for x in size_lst} for size in size_lst: print ("\nMODEL:\t{}\tSIZE:\t{}".format(name, size)) sizes[size]['weight'] = positive_float_input("Enter weight (Kg): ") sizes[size]['price'] = positive_float_input("Enter cost (US $): ") print models[name]=Model(name, category, description, colors, sizes)