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
____ are systems in which queues of objects are waiting to be served by various servers
Ksju [112]

Answer: Queuing systems

Explanation:

We have  the queuing theory which gives us the in depth knowledge of queuing systems which helps us to predict the queue length and the waiting time at the respective nodes in an network. A group of queuing systems together constitute the queuing network. The queuing theory helps to cope with the demand of various services in an queuing network composed of queuing systems.

4 0
3 years ago
How can website illustrate cooperations and kidness?
Brilliant_brown [7]
It can illustrate cooperation's and kindness by allowing many different people and strangers to post their opinions and thoughts as long as they are being positive about it! Hope i helped
8 0
3 years ago
चार फरक छुट्याउनुहोस् ।) 3. Write down any four provisions of cyber ethic साइबर नैतिकताका कुनै चार प्रावधानहरु लेख्नुहोस् ।​
Kruka [31]

Answer:

Five provisions of cyber ethics are:

Your computer or system should not be used to harm others. Your cyber knowledge should not be used to steal other people's resources. One should not use or copy softwares for which you have not paid. ... Never use other people's resources without their consent.

7 0
2 years ago
What does it mean to read visual and audio text
solniwko [45]

Talking books could be a means to automatize and generalize such an audio–visual reading experience. ... RWL consists of an experimental reading situation where one reads a text while one can hear it said aloud by a prerecorded speaker or by a text-to-speech system.


5 0
3 years ago
(03.05 LC) Match the term with its description. (4 points) Column A 1. Acid : Acid 2. Alkaline : Alkaline 3. pH : pH 4. Ion : Io
Nady [450]

Answer:

Follows are the matching to this question:

Explanation:

Column  A            Column B

     1                           c

     2                          d

     3                          b

     4                          a

Description of the matching:

  • In 1(Acid) the correct choice is (c) because the acid (HCl) dissociates to both the H+ ion and the Cl- ion as a solution.  
  • In 2(Alkaline ) the correct choice is (d) because alkaline NaOH is a solution that differentiates between the ions ( OH-) and Na+.  
  • In 3(pH ) the correct choice is (b) because for an A compound of less than 7 is an acid and an alkaline pH compound of more than 7. For neutral compounds, a pH of 7 is applicable.
  • In 4(Ion) the correct choice is (a) because Na+ ion is loaded positive, and Cl-ion is loaded negatively.
8 0
3 years ago
Other questions:
  • Which of the following is NOT an ethical way of getting to the top of a web search?
    5·1 answer
  • A byte is made up of 8 bits (binary digits). You have a programming language that uses one byte to represent characters and are
    5·1 answer
  • Using a personal computer to produce high quality printed documents.
    10·1 answer
  • How to Create a while loop
    6·2 answers
  • You have a large TCP/IP network and want to keep a host's real time clock synchronized. What protocol should you use?
    10·1 answer
  • Who plays xbox one offline and knows some multiplayer games that can be played offline.
    15·2 answers
  • "Bookings are to be stored in three separate
    7·1 answer
  • Which of the following is not a common input device?
    6·1 answer
  • What is 2+2 I need to know hurry
    12·2 answers
  • An online bank wants you to create a program that shows prospective
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!