Iteration Value

image

I don’t quite understand I keep seeing the iteration value that you guys come up with, in this example it is c_rating. The c_rating is pointing to the variable ratings, but I don’t understand where did you come up with c_rating? Is that a variable inside ratings is this just like an empty variable we are creating? I haven’t quite understood this while I’ve been going through the course cause every iteration value doesn’t really seem to correlate or have a place. Hopefully this makes sense and this is the right place to ask this question. If you need me to further clarify please let me know, thanks!

That is just loop variable. That have local scope within loop block. You can give it any name.
Here c_rating will take one by one value from list ratings each time.

This mission would help if have not done it yet - https://app.dataquest.io/m/312/lists-and-for-loops/9/for-loops

Hi @joshuaroberts.it: I answered this query before in the first portion of this article. Basically c_rating is used for readability sake, so if you are working on a large scale project with your teammates, they know exactly what you are referring to and so its better to use such more descriptive iterators rather than use iterators like i, which may not have significant meaning.

Hope this clarifies!