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
Roman55 [17]
2 years ago
6

Write a loop that continually asks the user what pets the user has until the user enters rock in which case the loop ends. It sh

ould acknowledge the user in the following format. For the first pet, it should say You have a dog with a total of 1 pet(s) if they enter dog, and so on

Computers and Technology
1 answer:
mote1985 [20]2 years ago
6 0

Loops are program statements that are repeated as long as the loop condition is true.

The loop in Python, where comments are used to explain each line is as follows:

#This initializes the number of pets to 0

count = 0

#This gets input for the pet name

pet = input("Pet: ")

#This is repeated until the user enters "rock"

while pet.lower() != "rock":

   #This increases the number of pets by 1

   count+=1

   #This prints the pet and the number of pets

   print("You have a",pet,"with a total of",str(count),"pet(s)")

   #This gets input for the pet name

   pet = input("Pet: ")

Read more about loops at:

brainly.com/question/19344465

You might be interested in
Rows within a spreadsheet are identified by:
EleoNora [17]

Answer:

Option C: Numbers.

Explanation:

By default, rows within a spreadsheet are identified by Numbers i.e. 1,2,3,............

Total rows are 1048575 in one spreadsheet.

7 0
3 years ago
When creating databases, the different pieces of information are input into _______.
Tanya [424]
Fields. This one had me in doubt. Different kinds of information go into different database tables. A table contains rows (=records) made up of fields. So a field is the smallest "thing" in a database (much like a cell in a spreadsheet). So yes, I'd say fields is the correct answer.
4 0
3 years ago
Need help with this
Kryger [21]

Answer:

i say B

Explanation:

because u being professional makes ur company look good

7 0
3 years ago
My friend Leo wants to have an emergency plan for his final exams on University of Southern Algorithmville. He has N subjects to
leonid [27]

Answer:

Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. Greedy algorithms are used for optimization problems. An optimization problem can be solved using Greedy if the problem has the following property: At every step, we can make a choice that looks best at the moment, and we get the optimal solution of the complete problem.

If a Greedy Algorithm can solve a problem, then it generally becomes the best method to solve that problem as the Greedy algorithms are in general more efficient than other techniques like Dynamic Programming. But Greedy algorithms cannot always be applied. For example, the Fractional Knapsack problem (See this) can be solved using Greedy, but 0-1 Knapsack cannot be solved using Greedy.

The following are some standard algorithms that are Greedy algorithms.

1) Kruskal’s Minimum Spanning Tree (MST): In Kruskal’s algorithm, we create an MST by picking edges one by one. The Greedy Choice is to pick the smallest weight edge that doesn’t cause a cycle in the MST constructed so far.

2) Prim’s Minimum Spanning Tree: In Prim’s algorithm also, we create an MST by picking edges one by one. We maintain two sets: a set of the vertices already included in MST and the set of the vertices not yet included. The Greedy Choice is to pick the smallest weight edge that connects the two sets.

3) Dijkstra’s Shortest Path: Dijkstra’s algorithm is very similar to Prim’s algorithm. The shortest-path tree is built up, edge by edge. We maintain two sets: a set of the vertices already included in the tree and the set of the vertices not yet included. The Greedy Choice is to pick the edge that connects the two sets and is on the smallest weight path from source to the set that contains not yet included vertices.

4) Huffman Coding: Huffman Coding is a loss-less compression technique. It assigns variable-length bit codes to different characters. The Greedy Choice is to assign the least bit length code to the most frequent character. The greedy algorithms are sometimes also used to get an approximation for Hard optimization problems. For example, the Traveling Salesman Problem is an NP-Hard problem. A Greedy choice for this problem is to pick the nearest unvisited city from the current city at every step. These solutions don’t always produce the best optimal solution but can be used to get an approximately optimal solution.

6 0
3 years ago
5 steps in cleaning and sanitizing smokehouse​
topjm [15]

Answer:

  1. Scrape or remove food bits from the surface.
  2. Wash the surface.
  3. Rinse the surface.
  4. Sanitize the surface.
  5. Allow the surface to air-dry.

Explanation: These are steps for cleaning and sanitizing.

4 0
3 years ago
Other questions:
  • In a formatted text file, ________ signal(s) the beginning and end of a formatting command.
    12·1 answer
  • Software that controls a computer. an os controls how system resources are used and provides a user interface, a way of managing
    13·1 answer
  • You want to use a terminal emulation program to terminal into a series of Cisco routers. You will be managing these devices remo
    9·1 answer
  • You have been asked to create a query that will join the Production.Products table with the Production.Categories table. From th
    6·1 answer
  • Want summmmmmmm bec i do lol
    9·1 answer
  • Your laptop donot have a serial port. what type of connector will your laptop requireyour laptop donot have a serial port what t
    7·1 answer
  • Eşhedü en la ilahe illallah ve eşhedü enne Muhammeden abdühü ve resulühü
    11·1 answer
  • Choose the best function for the purpose.
    11·1 answer
  • Ple Choice Worth 5 points)
    11·1 answer
  • Data modeling may be the most important part of the systems development process because: Group of answer choices data are less s
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!