261099 261099
  • 03-11-2020
  • Computers and Technology
contestada

What is the output of the following program?

for num in range(4):
print (num * 2)

Respuesta :

Cytokine
Cytokine Cytokine
  • 03-11-2020

The range() function with one parameter defaults to a starting value of 0 and has an ending value of the number specified exclusive.

range(4) is all the integers between 0 and 4 not including 4.

for num in range(4):

   print(num*2)

The output would be 0 2 4 6 all on separate lines.

Answer Link

Otras preguntas

What were the Great Society programs?
A chemical reaction has reached equilibrium when
Read the sentence carefully. Which revision corrects the error? Joseph chose not to practice his most important piece his solo. Joseph chose not to practice: hi
example of industrialization
Which of the following is NOT a conclusion of the Central Limit​ Theorem? Choose the correct answer below. A. The mean of all sample means is the population mea
A 0.43-kg object mass attached to a spring whose spring constant is 561 N/m executes simple harmonic motion. If its maximum speed is 8 m/s, what is the amplitud
What is public speaking?
An object at the surface of Earth (at a distance R from the center of Earth) weighs 166 N. What is its weight (in N) at a distance 4R from the center of Earth?
CAN ANYONE PLEASE HELP ME WITH THIS QUESTION???
(b) dy/dx = (x-y + 1)^2