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 is 0.2 times 0.8
Patrick buys 3 model airplanes for p dollars each and Amanda buys 2 models for 36 dollars Find the value of p so they both pay the same amount of money for the
In what situation can you use only multiplication to find equivalent fractions to a given fraction? Give an example..
Text’s genre is determined by the __________. length of the piece of writing time period of the writing author’s reputation and bias traits it has in common wit
Green plus blue equals ?
which of the following treatments kills bacteria inside the body
N2 is what type of covalent bond
Select all that apply. What were the major goals of the United Nations in 1945? A)to promote human rights B)to prevent war C)to provide a basis for internationa
What does prerecord mean
true or false An understanding of how human activity affects the environment is important for environmental policy makers.