Answer:
budget=455
shopping_list=("codelab", "textbook", "ipod", "cd", "bike")
prices={"codelab":300, "textbook":100,"ipod":50, "cd":10, "bike":600}
number_of_items=0
sum=0
for index in range(len(shopping_list)):
sum=sum+prices[shopping_list[index]]
if (sum<=budget):
number_of_items=number_of_items+1
else :
break
print "number of items you can purchase, for a budget of",budget,"is",number_of_items
Explanation:
A code to determine the number of items that can be purchased is above, given the value associated with budget, and given that you will buy items in the order that they appear in the tuple associated with shopping_list.