def minPizza(pizza_orders):
i=0
for username in pizza_orders.keys():
#looping across the dictionary using keys (username)
#calculating the total money
spent
total_cost=pizza_orders[username]["number_of_pizzas"] *
pizza_orders[username]["price_per_pizza"]
if(i==0): #if first
loop
least_spent_username=username
least_spent_value=total_cost
i=1
else: #for all other
loops except the first
if(total_cost<least_spent_value): #if less than
least
#replace the least with current values
least_spent_username=username
least_spent_value=total_cost
return least_spent_username #return username
pizza_orders={
"mark123":{
"number_of_pizzas":3,
"price_per_pizza":20.00
},
"alice666":{
"number_of_pizzas":2,
"price_per_pizza":24.00
}
}
print(minPizza(pizza_orders))
Please give a like
Q3 Coding challenge 2 5 Points Suppose you are hired as a developer in a pizzeria....