196k views
0 votes
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)

2 Answers

3 votes

Answer:

Choose what you think based on this.

Step-by-step 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.

User Shantanu Kher
by
4.8k points
5 votes

Answer:

The answers are:

definite

for

Step-by-step explanation:

proof:

Please help me! When you know ahead of time how many passes you will make through-example-1
User Tommie Jones
by
4.5k points