1answer.
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
What is the purpose of a mail merge field.
coldgirl [10]

adding merge fields is a way to personalize a document with information from the data source. The merge fields come from the column headings in the data source.

:)

3 0
3 years ago
With modeling and simulation, we model the system and then test the ______________ to gather test predictions.
Kobotan [32]

Answer:

With modeling and simulation, we model the system and then test the system to gather test predictions.

Explanation:

You would have to test the system in order to see if it's working right and everything is all good with the system.

I hope this helped. I am sorry if you get this wrong.

4 0
2 years ago
When breaking a problem down, you often encounter elements that you want to use repeatedly in your code. Sometimes it's appropri
ddd [48]

<u>Answer:</u>

<em>FUNCTION:</em>

  • A function does not require the number of times that the <em>code script needs to be executed </em>
  • When we go for large programming, ie. while creating projects, we can invoke function from one file to another based on the access <em>specifier mentioned for the function. </em>
  • There is a stack call created in the memory whenever a <em>function is called. </em>

<em>LOOP :</em>

  • Whereas the number of times that the loop has to be <em>executed must be defined </em>
  • A loop cannot be called, it can be used only the code block in <em>which it is present. </em>
  • There is not overhead of creating a stack since it is not invoked and there is no <em>transfer of control from one module to another </em>

8 0
3 years ago
Hard disk works on the following technologies: (i) Technology used within the hard drive to read &amp; write data to the drive a
Alex787 [66]

Answer:

The green-blue circuit board you can see in the first photo includes the disk controller, a circuit that allows the computer to operate the drive's mechanisms and read/write data to and from it. ... A small hard drive typically has only one platter, but each side of it has a magnetic coating

Explanation:

8 0
2 years ago
Sql is an example of a ________ category programming language. 4gl 3gl 5gl 2gl
kicyunya [14]
The answer is Fourth-generation language (4GL).  <span>Sql is an example of a 4GL category programming language.  </span>SQL<span> is considered a Fourth-generation </span>language<span> (</span>4GL), whereas Java and C++ are third-generation languages<span> (3GLs). Fourth-generation </span>languages<span> are programming  </span>languages<span> that are closer to human </span>language<span> than the high-level </span>languages<span>  like Java.</span>
8 0
3 years ago
Other questions:
  • All of the following are examples of a web application except for ______.
    12·2 answers
  • When driving, your attention is __________.
    5·2 answers
  • Write a complete C++ program that do following. Read a positive integer from the user with proper prompt. Assume that this user
    9·1 answer
  • The picture that graphically represents the items you use in windows is called a/an
    5·1 answer
  • What is the order of adding 10.0 to each element in a one-dimensional array of N real numbers?
    13·1 answer
  • Which option is the strongest password?
    7·2 answers
  • In a case where electrical current leakage from the circuit occurs, the GFCI would do the following:
    10·1 answer
  • Unlike radio frequency identification (RFID) tags, bar codes: Question 30 options: require a reader that tunes into a specific f
    14·1 answer
  • What were the social, political, cultural, or economic context in which the was invention made?
    14·1 answer
  • Which of the following is true about named ranges?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!