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
dedylja [7]
2 years ago
11

Below, we’ve provided a for loop that sums all the elements of list1. Write code that accomplishes the same task, but instead us

es a while loop. Assign the accumulator variable to the name accum.
Computers and Technology
1 answer:
Tanzania [10]2 years ago
5 0

Answer:

Explanation:

The code that would best accomplish this task using a while loop would be the following:

list1 = [8, 3, 4, 5, 6, 7, 9]

accum = 0

n = 0

while n < 7:

        accum += list1[n]

        n += 1

This code will continue throughout the list1 array and add every value to the accum variable.

You might be interested in
What forms the foundation of cloud computing?
makkiz [27]
Virtualization. To enable easy deployment and scalability, it should be easy to spin up new machines on request. Virtualization offers the possibility to clone operating systems and deploy solutions independent of the actual hardware.
8 0
3 years ago
What is the empty space inside the character 'O' called?
mariarad [96]

Answer:

In typography, a counter is the area of a letter that is entirely or partially enclosed by a letter form or a symbol (the counter-space/the hole of). The stroke that creates such a space is known as a "bowl".

7 0
3 years ago
Implement a class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon or liters/kmâ
zvonat [6]

Answer:

class Car(object):

   fuel = 0

   def __init__(self, mpg):

       self.mpg = mpg

   def drive(self, mile):

       if self.fuel * self.mpg >= mile:

           self.fuel -= mile / self.mpg

       else:

           print(f"get gas for your {self}")

       print(f"Fuel remaining: {self.fuel}")

   #classmethod

   def get_gas(cls):

       cls.fuel += 50

   #classmethod

   def add_gas(cls, gallon):

       if cls.fuel + gallon > 50:

           cls.fuel += 10

       else:

           cls.fuel += gallon

gulf = Car(20)

gulf.get_gas()

gulf.drive(200)

Explanation:

The Car class is defined in Python. Its drive method simulates the driving of a car with fuel that reduces by the miles covered, with efficiency in miles per gallon. The get_gas and add_gas methods fill and top up the car tank respectively.

3 0
2 years ago
Help me
denis23 [38]

Answer:

a = 6, b = 0

Explanation:

The loop ran 3 times before b == 0. "while ((b != 0)" is essentially saying: 'While b is not equal to 0, do what's in my loop'. Same general thing with "&& ((a / b) >= 0)". The "&&" is specifying that there should be another loop condition, while the rest states: 'as long as a ÷ b is greater than 0, do what's in my loop'. If both of these conditions are met, the loop will run, It will continue this until the conditions are not met. Hope that helped! :)

7 0
2 years ago
( ABOVE TRUSTED HELPER ONLY)Why does my rank say that I have one
prohojiy [21]
That’s a really good question but that means something is wrong with it refresh your screen or close the page app
6 0
3 years ago
Read 2 more answers
Other questions:
  • 1. Mobile devices have a _________ viewport that displays a web page content that fits within a mobile screen.
    11·1 answer
  • A cache has been designed such that it has 512 lines, with each line or block containing 8 words. Identify the line number, tag,
    7·1 answer
  • In c++ 11, the ________ tells the compiler to determine the variable's data type from the initialization value.
    6·1 answer
  • Brainliest for whoever adds me on snap<br> gianavaughn007
    15·2 answers
  • The lines that connect the points of a polygon are called: (1 point)
    6·2 answers
  • Case Study
    15·1 answer
  • Witch icon allows you to see paragraph formatting feature
    6·1 answer
  • Wht is these things Aᔑ bʖ cᓵ d↸ eᒷ f⎓ g⊣ h⍑ i╎
    15·2 answers
  • How do i stop my computer from automatically connecting to a wireless network
    5·1 answer
  • HELPPPP MEEEE!!!!! ITS LIFE OR MUERTEEE
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!