lundi 28 avril 2014

creating a number of items can be purchased on a shopping list


Vote count:

0




I am a new computer science student and struggling with this codelab question.


Assume you have a variable , budget , that is associated with a positive integer. Assume you have another variable , shopping_list , that is a tuple of strings representing items to purchase in order of priority. (For example: ("codelab", "textbook", "ipod", "cd", "bike") ) Furthermore, assume you have a variable , prices that is a dictionary that maps items (strings such as those in your shopping_list ) to positive integers that are the prices of the items.


Write the necessary code to determine the number of items you can purchase, 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 . Associate the number of items that can be bought with the variable number_of_items .



asked 29 secs ago






Aucun commentaire:

Enregistrer un commentaire