python-hard-way/Codecadmey Projects/lens-pizza.py

15 lines
469 B
Python

toppings = ['pepperoni', 'pineapple', 'cheese', 'sausage', 'olives', 'anchovies', 'mushrooms']
prices = [2, 6, 1, 3, 2, 7, 2]
num_pizzas = len(toppings)
print("We sell " + str(num_pizzas) + " kinds of pizza!")
pizzas = list(zip(toppings, prices))
pizzas.sort(key=lambda x: x[1])
cheapest_pizza = pizzas[0]
priciest_pizza = pizzas[-1]
three_cheapest = pizzas[0:3]
print(pizzas)
print(three_cheapest)
num_two_dollar_slices = prices.count(2)
print(num_two_dollar_slices)