cheeses = ["adam", "bree", "camambert", "gouda", "grouyer"]
entitled_cheeses = []
i=0
while i<len(cheeses):
entitled_cheeses.append(cheeses[i].title())
i+=1
print(entitled_cheeses)
entitled_cheeses = []
for cheese in cheeses:
entitled_cheeses.append(cheese.title())
print(entitled_cheeses)
[cheese.title() for cheese in cheeses]
[2**pow for pow in range(16)]
[len(cheese) for cheese in cheeses]
cheese_prices = {
'Adam' : 2,
'Bree' : 3,
'Camambert' : 4,
'Gouda' : 5
}
missing = { 'Adam' }
buy = ['Adam', 'Bree']
# buy_prices = [ cheese_prices[item] for item in buy]
total = sum([ cheese_prices[item] for item in buy])
print(total)
total = sum([ cheese_prices[item] for item in buy if item not in missing])
print(total)
item in missing
new_prices = {
cheese: price*1.1 for cheese, price in cheese_prices.items() }
print(new_prices)
d144 = { "avi" : "053",
"ben" : "054",
"gaddy" : "055"}
d441 = { phone:name for name, phone in d144.items() }
print(d441)
d = {}
reverse_d = {value:key for key, value in d.items()}