Beispiel #1
0
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 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
Beispiel #3
0
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