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]
3 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]3 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
Wendy wants to learn how to write a computer program that can get the dimensions of a rectangle from the user and then tell the
otez555 [7]

Answer:

algorithms for finding the area

Explanation:

you need algorithms to find out any computer input information.

4 0
3 years ago
Read 2 more answers
Yuri is a skilled computer security expert who attempts to break into the systems belonging to his clients. He has permission fr
Tatiana [17]

Answer:

b) White-hat hacker

Explanation:

This is also called an ethical hacker. Unlike the other options, a white-hat hacker is a person specialized on computational security which offers services to organizations to test how safe they are from informatic attacks (viruses, theft of information, etc). This is carried out  based on a agreement between the whihte-hat hacker and the client via a contract.  

8 0
3 years ago
Which industry did the Interstate Commerce Act primarily affect? A. coal B. airplane C. steel D. oil E. railroad
babunello [35]

I believe the answer is E. Railroad, hope this helps!

6 0
3 years ago
Read 2 more answers
Using the 4 Cs, we consider where a company may decide to offer the product or service to customers. Whether online or in a phys
DanielleElmas [232]

Answer:

"Place" in the 4P's.

Explanation:

The 4C's marketing model was formulated in the year 1990 by Robert Lauterborn. The 4C's comprises of; Customer value, Cost, Convenience, and Communication. It is important to know that this marketing model is an improvement of the 4P's model.

Convenience implies that any product being marketed has to be made easily accessible to the customers. The location should also make it possible, that the product is easily seen by the customers.

Place was a concept in the 4P's model that sought to resolve the problem of where the product can be best distributed. The introduction of Convenience in the 4C's improved on it, and extended it to imply that there must be a high level of accessibility of the product.

3 0
2 years ago
When would you find the merging cells feature useful?
oksano4ka [1.4K]

Answer:

It is very useful when you want to combine two or more cells without losing any data.

Explanation:

<em>Merging cells is one of the functions in a database software or even a spreadsheet software that would allow users to combine data in several cells without losing any data in them. Merging cells can also be used when you want several cells to be under a single heading or header.</em>

7 0
3 years ago
Other questions:
  • A document repository is down when you attempt to access it. which isa principle is being violated?
    13·1 answer
  • This provides an easy method for workers to use their computers.
    11·2 answers
  • 24 bit or 16 million colors is often called?
    7·1 answer
  • what is the largest possible number of internal nodes in a redblack tree with black height k? what is the smallest possiblenumbe
    11·1 answer
  • To begin importing data from an excel spreadsheet, click on the ____ tab on the ribbon.
    11·1 answer
  • Name the functional arms of MSDE.
    13·1 answer
  • The _____ feature will mark all changes made to a document for others to review at a later time.
    13·1 answer
  • You can resize a row in a table by dragging the ____.
    13·1 answer
  • What is the most complex part of a PC?
    6·1 answer
  • A(n) ________ is often developed by identifying a form or report that a user needs on a regular basis.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!