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 are at least 5 general PowerPoint guidelines that's you find useful and provide an example of how you would use each in real life setting
Does a scalene always have to have unequal sides?
solve for x₁ and x₂6x₁+3x₂=606x₁-2x₂=80
What does it mean when Brutus says: "Into what dangers would you lead me, Cassius... that you would have me seek into myself...for that which is not in me?
How do you find the length of a circle in geometry?
Does a scalene always have to have unequal sides?
A registered nurse (RN) pays 5% simple interest on a $175,000 mortgage for the construction of a house. What is the yearly interest paid on the mortgage?
Is Smoking in Japan Illegal? Please help me :)
A soccer team played 160 games and won 65 percent of them. How many games did it win ?
Did Maya Angelou's uncle kill the mom's boyfriend after finding out he raped Maya or beat him to death?