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

Words to match the expression 36÷4
What sort of problem do you use acceleration due to gravity ? What sort of problem do you not ?
9.14 to the nearest tenth
500 reduced by 4 times my age is 232 .
why is 743 a prime number
what happened to the loyalists property after the revolutionary war was over
what is the reference angle of 330° degrees
53°c below zero is what
Can a change in matter take place in which energy is neither released nor absorbed?
Experts agree that the minimum time period for cardiorespiratory benefit from exercise is _______ minutes.      A. 20B. 10C. 60D. 30