answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
denis-greek [22]
2 years ago
11

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.
Computers and Technology
1 answer:
max2010maxim [7]2 years ago
4 0

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.

You might be interested in
A ____ partition contains the data necessary to restore a hard drive back to its state at the time the computer was purchased an
Oxana [17]
The answer is back up
8 0
2 years ago
Read 2 more answers
Dillard’s wants to learn about its consumers' attitudes toward online purchases. There are numerous studies that are available a
Kamila [148]

Answer:

Indirect/secondary source; direct/original source.

Explanation:

Data is a vital piece of information. It is generated from various physical or abstract activities. There are different sources of data. They are direct source, indirect source, static source, dynamic source etc.

The direct source is also called the original source data because information gotten from it is directly retrieved from a target audience or observed samples. Indirect or secondary source data is gotten from an already existing databases, which may or may not have been used for analysis.

Static source data hardly changes or updates while dynamic sources updates constantly.

4 0
2 years ago
Ben's team is working on an English project. The members want to see everyone's progress on their part of the project. What tech
Kruka [31]
Web conferencing would allow you to communicate freely with the team but cloud computing allows you to share data between the group. The answer would be A. Cloud Computing
7 0
2 years ago
Read 2 more answers
What is illustrated in the cells to the right of the Fourth Quarter column?
beks73 [17]
Photosynthesis is illustrated in the cells to the right of the fourth column
5 0
2 years ago
Read 2 more answers
When you check to see how much RAM, or temporary storage you have available, you are checking your _____.
victus00 [196]

Answer: primary memory

5 0
2 years ago
Other questions:
  • Assume that a kernel is launched with 1000 thread blocks each of which has 512 threads. If a variable is declared as a shared me
    6·1 answer
  • When employees have multiple concurrent connections, what might be happening to the VPN system?
    7·1 answer
  • C++ :Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the outpu
    13·1 answer
  • "online privacy alliance (opa) is an organization of companies dedicated to protecting online privacy. members of opa agree to c
    15·1 answer
  • Develop an EER model for the following situation using the traditional EER notation, the Visio notation, or the subtypes inside
    8·1 answer
  • Use the following data definitions data myBytes BYTE 10h,20h,30h,40h myWords WORD 3 DUP(?),2000h myString BYTE "ABCDE" What will
    9·1 answer
  • Using virtualization comes with many advantages, one of them being performance. Which of these is NOT another realistic advantag
    7·1 answer
  • Show how the recursive multiplication algorithm computes XY, where X = 1234 and Y = 4321. Include all recursive computations.
    11·1 answer
  • Given a sorted list of integers, output the middle integer. A negative number indicates the end of the input (the negative numbe
    13·1 answer
  • Which are technical and visual demands that need to be considered when planning a project? Choose three answers
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!