HenryLez HenryLez
  • 06-11-2020
  • Computers and Technology
contestada

Review how to write a for loop by choosing the output of this short program.

for counter in range(3):
print(counter * 2)

2
3
4


0
2
4


0
1
2


2
4
6

Respuesta :

Cytokine
Cytokine Cytokine
  • 06-11-2020

This for loop will output:

0

2

4

The range(3) is all the integers between 0 inclusive and 3 exclusive. 0, 1, 2.

Every iterations through the for loop, we multiply the value of each number by 2 and print it to the console.

0 * 2 = 0

1 * 2 = 2

2 * 2 = 4

I hope this helps.

Answer Link
starwars920jack
starwars920jack starwars920jack
  • 13-01-2021

Answer:

The answer is 0 2 4. I hope this helps you out. Have a wonderful day and stay safe.

Explanation:

Answer Link

Otras preguntas

identify the belief system that spread to China from India during the late Han period and appealed to the people during the trubuleng times
find the perpendicular distance between (2,5) and the line 2x - y + 7 = 0 in a surd form with a rational denominator
Equation of the line parallel to the equation y = -2x - 7 that passes through the point (3, 1).
Soil liquefaction occurs when
this is stumping me. it's a geometry proof question, and i really need help! diagram and statements are attached in a picture.
Divide 48 into the ratio of 5:3
why does sodium hydroxide solution affect the requirements for photosynthesis?
Examples of Idioms in true grit
how do you say frog in Spanish?
The movement of oceans has no impact on the Earth’s climate. True Or false? Explain please?
good job