In Level 9, we used "WHILE" loops to repeat code based on a condition. But what if you have a specific list of items or a set number of times you want to run your code? In Level 10, we introduce the FOR LOOP.
A FOR loop in Python is designed to go through a "SEQUENCE." Using the RANGE() function, you can tell Python exactly how many times to sprout a new line of code. The variable I acts as a placeholder that keeps track of which "LAP" the loop is currently on.
THE RANGE(START, STOP) FUNCTION GENERATES NUMBERS. NOTE THAT PYTHON STARTS COUNTING AT 0 AND STOPS ONE NUMBER BEFORE THE STOP VALUE. SO, RANGE(5) GIVES YOU: 0, 1, 2, 3, 4.
USE A FOR LOOP WITH RANGE(1, 11) TO PRINT THE NUMBERS 1 THROUGH 10. CAN YOU MODIFY THE CODE TO PRINT "WATERING PLANT NUMBER..." FOLLOWED BY THE LOOP VARIABLE?