-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpizza.py
34 lines (21 loc) · 848 Bytes
/
pizza.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
In this projects I used lists in Python to organise sales data for a pizza joint.
"""
toppings = ["pepperoni", "pineapple", "cheese", "sausage", "olives", "anchovies", "mushrooms"]
prices = [2, 6, 1, 3, 2, 7, 2]
num_two_dollar_slices = prices.count(2)
print(num_two_dollar_slices)
num_pizzas = len(toppings)
print(num_pizzas)
print("We sell " + str(num_pizzas) + " different kinds of pizzas!")
pizza_and_prices = [[2, "pepperoni"], [6, "pineapple"], [1, "cheese"], [3, "sausage"], [2, "olives"], [7, "anchovies"], [2, "mushrooms"]]
pizza_and_prices.sort()
print(pizza_and_prices)
cheapest_pizza = pizza_and_prices[0]
priciest_pizza = pizza_and_prices[-1]
pizza_and_prices.pop()
print(pizza_and_prices)
pizza_and_prices.insert(4, [2.5, "peppers"])
print(pizza_and_prices)
three_cheapest = pizza_and_prices[:3]
print(three_cheapest)