Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In python Some tasks are best handled by \"definite iteration\" (a for loop), bu

ID: 3847005 • Letter: I

Question

In python

Some tasks are best handled by "definite iteration" (a for loop), but "indefinite iteration" (a while loop) is better for others. For each task below specify which type of iteration is best Write "for" or while in each case: Summing the first n values in a list. Summing the values in a list up to, but not including the first value that is less than 0 Printing all of the values in a list in order. Finding the average of values entered by a user until the user enters the string "quit". Finding the value of n at which the ratio, fibonacci (n)/fibonacci (n-1), is within 1.0e-10 of the golden ratio. [Remember Labo3.]

Explanation / Answer

Solution:

a. "definite iteration" (a for loop ) is best suited here.

Explanation:

b. "indefinite iteration" (a while loop) is best suited here.

Explanation:

c. "definite iteration" (a for loop) is best suited.

Explanation:

d. "indefinite iteration"(a while loop) is best suited

Example:

e. "indefinite iteration"(a while loop) is best suited

Explanation:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote