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

A uniform wire is cut into 4 segments. Each segment is twice as long as the earlier segment. If the shortest segment has a resistance of 4 ohm, find the resista
What positive and negative traits does Odysseus demonstrate in his adventure with the Cyclop's?
(z+4)(z+3) Please Help!
in che anno e nato Cristoforo Colombo
A microscope is set so it makes an object appear 4 x 10`2 times larger than its actual size. A virus has a diameter of of 2 x 10`-7 meter. how large will the di
a rectangular table top measures 4/9 of a meter long by 4/5 of a meter wide. the area is _____ square meter.
Which statement accurately describes the Battle of Marathon?   A. Athens fought alone against Darius's army and decisively defeated the Pers
in che anno e nato Cristoforo Colombo
what does the numerator tell us in fraction
Did Maya Angelou's uncle kill the mom's boyfriend after finding out he raped Maya or beat him to death?