Seudónimo Seudónimo
  • 20-11-2020
  • Computers and Technology
contestada

please help me!
When you know ahead of time how many passes you will make through a loop, a(n) ____(definite/indefinite) loop is best. Such a loop uses ____. (while/for)

Respuesta :

vfxdead
vfxdead vfxdead
  • 20-11-2020

Answer:

Choose what you think based on this.

Explanation:

with a for loop:

>>> students = 3

>>> for student in range(students):

>>> print(student)

would output

>>> 0

>>> 1

>>> 2

with a while loop now:

>>> students = 3

>>> student = 0

>>> while student < students:

>>> student = student + 1

>>> print(student)

the for loop is more compact than the while loop. But there may be some times when a you cant do a for loop. The first question is more than likely definite but I don't know the second answer.

Answer Link

Otras preguntas

what process was necessary to grow crops on a regular basis in  Mesopotamia
what is 6=hj+k for j
Melissa is 13 years old, Becky is 12 years old and Daniel is 10 years old. Melissa, Becky and Daniel share £28 in the ratio of their ages. Becky gives a third o
v/w = 9 for w Please note that the dash between v and w means the fraction sign
express the recurring decimal 0.281 as a fraction  in its simplest form. ( the '81' are the only two recurring)
explain why x and 4x -10 are factors of the expression x(4x-10)^ rather than terms of the expression . what are the terms of the factor 4x-10?
am nevoie de o scrisoare informala
which is the best definition of federalism?
A high school purchases two workbooks for every textbook, and two journals for every workbook. If the school purchases 301 total items, how many of each do they
which is the most valid definition of a republican form of government?