More about the for loop and the range() function with three arguments
The
range() function may also accept three arguments - take a look at the code in the editor.
The third argument is an increment - it's a value added to control the variable at every loop turn (as you may suspect, the default value of the increment is 1).
Can you tell us how many lines will appear in the console and what values they will contain?
Run the program to find out if you were right.
You should be able to see the following lines in the console window:
The value of i is currently 2
The value of i is currently 5
No comments:
Post a Comment