Question
In Python, we can implement this iterative algorithm with a for loop. We used the following for loop in Section 2.2 to draw our geometric
In Python, we can implement this iterative algorithm with a for loop. We used the following for loop in Section 2.2 to draw our geometric flower with eight petals: for count in range (8): tortoise. forward(200) tortoise. left(135) In this case, we need a for loop that will iterate three times: population = 12000 for year in range (3): population = 1.08 * population - 1500 Reflection 4.1 Type in the for loop above and add the following statement after the assignment to population in the body of the for loop: print (year + 1, int (population)) Run the program. What is printed? Do you see why?
Havill, Jessen. Discovering Computer Science (Chapman & Hall/CRC Textbooks in Computing) (p. 132). CRC Press. Kindle Edition.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started