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
A tool you might use to manipulate an image, such as a photograph, into a seamless repeating texture would be:
nika2105 [10]

I believe the answer is D. I hope I helped :)

7 0
3 years ago
Read 2 more answers
How to build a 5*32 decoder by using 3*8 and 2*4 decoders? (digital design)
quester [9]
Assuming decoders with enabler.
input with rectangle is the ENABLE input.
wire with "/" on it is a bundled wire with multiple values to save drawing space.
In1 is MSB, In5 is LSB.

messy drawing as I'm in vehicle.

8 0
3 years ago
Write a C function namedliquid()that is to accept an integer number and theaddresses of the variablesgallons,quarts,pints, andcu
salantis [7]

Answer:

#include <stdio.h>

#include <math.h>

void liquid(int ,int*,int*,int*,int*);

int main()

{

int num1, gallons, quarts, pints, cups;  

printf("Enter the number of cups:");

scanf("%2d",&num1);  

liquid(num1, &gallons, &quarts, &pints, &cups);  

return 0;

}  

void liquid(int x, int *gallons, int *quarts, int *pints, int *cups)

{

static int y;

y = x;  

if (y >= 16)

{

*gallons = (y / 16);

printf("The number of gallons is %3d\n", *gallons);

}

if (y - (*gallons * 16) >= 4)

{

*quarts = ((y - (*gallons * 16)) / 4);

printf("The number of quarts is %3d\n", *quarts);

}

if ((y - (*gallons * 16) - (*quarts * 4)) >= 2)

{

*pints = ((y - (*gallons * 16) - (*quarts * 4)) / 2);

printf("The number of pints is %3d\n", *pints);

}

if ((y - (*gallons * 16) - (*quarts * 4) - (*pints *2)) < 2 || y == 0)

{

*cups = (y - (*gallons * 16) - (*quarts * 4) - (*pints *2));

printf("The number of cups is %3d\n", *cups);

}

return;

}

5 0
3 years ago
What is the significance of both RAID and IP technologies as precursors to the SAN environment?
Dominik [7]

Explanation:SAN(Storage area network) technology is the network technology that is used for the accessing of the block level network towards the storage units. It is made up of the storage components, switches etc.

RAID(Redundant Array of Independent Disks) and IP(internet protocol) is used as the precursor because they work better than the SAN. They have the ability to solve the issue that occur in the SAN technology like complexity,and other faulty issues.They maintain the fault tolerance quality and maintaining the network.

3 0
4 years ago
When you first launch presentation software, how many blank slides will appear on your screen?
nataly862011 [7]

one, the title slide

6 0
3 years ago
Read 2 more answers
Other questions:
  • Why are fixed resistors’ values indicated by color bands rather than printing the numeric value on their exterior?
    13·1 answer
  • Explain Spreadsheet and its Basics
    13·1 answer
  • Write a program to read a record from a binary file
    8·1 answer
  • Linux applications are developed using ________ programming language.
    7·1 answer
  • PLEASE HELP
    11·2 answers
  • I need the answer ASAP. I’ll mark brainliest if right
    5·1 answer
  • if you want to build a smart-glove that responds based on the direction and speed a user moves their hand, what sensor should yo
    6·1 answer
  • Compare the freedom available to the American media with the freedom available to media in other parts of the world. How does a
    8·1 answer
  • Frank - as the Scrum Master of a Scrum Team - is invited for a Daily Scrum meeting at 9am. The teamgets together in front of the
    9·1 answer
  • Write short notes on the following:<br>I. keyboard ii.Control unit iii.printer​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!