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

write a paragraph with these words : scarcity economics need want factors of production and capital
A piano trio is made up of a. three pianos. b. a piano, an organ, and a pianoforte. c. a piano, a violin, and a viola. d. a piano, a violin, and a cello.
Which is not a way a citizen can participate in policy-making decisions
What interpretation of this image supports Moctezuma's understanding of human sacrifice? What was the result of Huyana Capac's military campaigns in the north?
What type of triangle has two congruent sides and two angles measuring 45 degrees?
Please Please Please Help Me In This English Homework!!!!!! Write a list of your behaviors (7-10) Choose 3 and identify the part of personality (Id, Ego, Supere
which three states each had only one battle during the American Revolutionary War
How does juliet want Romeo to prove his love
Mandela was eventually arrested and sentenced to death. a. True b. False
Highland ecosystems in North America usually consist of