Why use the range function to iterate a for loop for a specific count?

This is a new piece of information

Based on your explanation patrickd314, I assigned a different integer and it does print out the statement 5 times instead of integer 1->5

promise = “I will not chew gum in class”
for i in range(5):
print(promise)

Just my 2 cents on the Lesson discussed above, but I think Codecademy was trying to let you see that you didn’t have to use the same “variable” assigment listed above the “for” loop as the same “temporary” variable assignment inside the “for” loop. Doing this causes the variable assigned i.e. “promise” to be overwritten in your script. You do not have to define the “temporary” variable to the one listed in the lesson either. You can assign it to anything you want. The “temporary” variable is just a “placeholder” to “temporary” store each iterator in the range function as it iterates one by one through the “for” loop. Attached is a screen capture of what my script answer was vs. Codecademy. I got the answer right, even tells you what lines do not “exactly” match theirs and even pinpoints the exact location where your script differs from theirs. Here, the difference was in line 3 and the character “n” not being their “i” but the concept stands valid.

in the exercise we were asked to create a for loop to print the statement inside the “promise” variable 5 times … in a range of (0,5)
so I was pretty lazy today and I figured since the statement is already assigned to a variable , I won’t use it as temporary variable … and this is how my code went :

promise = "I will finish the python loops module!" for word in range(5): print(promise)

I used another temporary variable to iterate in the loop so I can be able to print the variable "promise without having to type in the whole statement
… And baam it worked … my question is : is it ok to do this anytime i’m feeling lazy like i did today or is it risky ? cause for me since it worked then it’s cool .