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
STALIN [3.7K]
2 years ago
10

Write a loop that continually asks the user what food the user has in their refrigerator until the user enters apples, in which

case the loop ends. It should acknowledge the user in the following format. For the first food, the user might say "hamburger," so your response would be, "You have a hamburger with a total of 1 food(s) if they enter hamburger, and so on until they enter “apples” at which point the loop ends. ---- make sure you save your file as "may28.py" *
Computers and Technology
1 answer:
almond37 [142]2 years ago
7 0

(Disclaimer: I am not a professional, so it might not be the most concise answer possible, but I did run the Python script and it works)

Answer:

user_input = input("What food do you have in your refrigerator? ").lower()

count = 0

while True:

   if user_input != 'apples':

       count += 1

       print(f'You have a {user_input} with a total of {count} food(s)\n')

       user_input = input("What food do you have in your refrigerator? ")

   else:

       break

You might be interested in
Organizational structures with one or more layers of authority between top-level management and employees are known as vertical
r-ruslan [8.4K]

The organizational structure described here, which is known as vertical organizational structure, is also commonly identified as tall organizations.

They usually have hierarchical structures, with the CEO being at the very top of the layer. Tall organization have multiple levels, compared to its counterpart, the flat organization or horizontal, which would only have one level.  

8 0
3 years ago
Read 2 more answers
Write a public member function which replace that replaces one occurrence of a given item in the ArrayBag with another passed as
ira [324]

Answer:

The method is written in Java

public static boolean abc(int [] ArrayBag,int num, int replace){

    Boolean done = false;

    for(int i =0; i<ArrayBag.length;i++){

        if(ArrayBag[i] == num){

            ArrayBag[i] = replace;

            done = true;

        }

    }

    for(int i = 0;i<ArrayBag.length;i++){

        System.out.println(ArrayBag[i]+" ");

    }

    return done;

}

Explanation:

The method is written in java

The arguments of the method are:

<em>1. ArrayBag -> The array declares as integer</em>

<em>2. num -> The array element to check the presence</em>

<em>3. replace - > The replacement variable</em>

This line defines the method as boolean.

public static boolean abc(int [] ArrayBag,int num, int replace){

This line declares a boolean variable as false

    Boolean done = false;

The following iterates through the elements of the array

    for(int i =0; i<ArrayBag.length;i++){

This checks if the array element exist

        if(ArrayBag[i] == num){

If yes, the array element is replaced

            ArrayBag[i] = replace;

The boolean variable is updated from false to true

            done = true;

        }

    }

The following iteration prints the elements of the array

<em>     for(int i = 0;i<ArrayBag.length;i++){</em>

<em>         System.out.println(ArrayBag[i]+" ");</em>

<em>     }</em>

This prints returns the boolean thats indicates if replacement was done or not.

    return done;

}

<em>Attached to this solution is the program source file that includes the main method of the program</em>

Download txt
5 0
3 years ago
Variables make it easier to do what?
defon
<span>D. Make changes to your code
Variables allow the ability to easily substitute numbers for other numbers.
</span>
8 0
3 years ago
Complete the function to return the result of the conversiondef convert_distance(miles):km = miles * 1.6 # approximately 1.6 km
AnnZ [28]

Answer:

The complete program is as follows:

def convert_distance(miles):

   km = miles * 1.6 # approximately 1.6 km in 1 mile

   return km

my_trip_miles = 55

# 2) Convert my_trip_miles to kilometers by calling the function above

my_trip_km =convert_distance(my_trip_miles) #3) Fill in the blank to print the result of the conversion

# 4) Calculate the round-trip in kilometers by doubling the result,

print("The distance in kilometers is " +str(my_trip_km))

# and fill in the blank to print the result

print("The round-trip in kilometers is " + str(my_trip_km * 2))

Explanation:

<em>The program is self-explanatory because I used the same comments in the original question.</em>

5 0
2 years ago
Kyle is running out of disk space on his hard drive on a Windows XP Professional system. He has installed and configured a third
Varvara68 [4.7K]

Answer:

The answer is "Disk utility".

Explanation:

It'll work well go over to Disk utility before updating the drivers like diskmgmt.msc throughout the Running box, or right-click Device icon, and pick Manage. Click Rescan Disks on the key decision-makers. It's not essential to reconnect until the machine recognizes the latest disc.

  • In each disc setup as storage properties is a reactive drive. Almost every dynamic disk is separated into quantities.
  • It is the season, spanned, and strip volume forms will be included.
5 0
2 years ago
Read 2 more answers
Other questions:
  • Solve system of equations. <br>x+2y-z=4<br>2x-y+3z=8 <br>-2x+3y-2z=10
    12·1 answer
  • What is Software? Write the functions of Software?​
    11·1 answer
  • How do you design video games
    5·1 answer
  • A windows host sends a tcp segment with source port number 1200 and destination port number 25. the sending host is a(n) _______
    10·1 answer
  • _____ provides vital protection and maintenance services for system hardware and software, including enterprise computing system
    12·1 answer
  • Write a MATLAB program to accomplish the following: Create two vectors, a and b, where vector a contains all positive integers l
    10·1 answer
  • ...................You like swamps
    13·2 answers
  • To indent an entire paragraph or list you should:
    9·1 answer
  • I NEED THIS ASAP PLS
    12·1 answer
  • A network administrator wants to authenticate server machines using Transport Layer Security (TLS). What can the administrator i
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!