Skip to content Skip to sidebar Skip to footer

New To Programming And I Am Having A Conceptual Block With The Range Function (explicit Values Versus Iterations)

I'm getting confused as to how range works in terms of iterating values. This is where I all of a sudden had a problem. Here's the code for sine v. degrees in radians: for angle i

Solution 1:

In the first code block, it says

for angle in range(10):

and then proceeds to say

y = math.sin(math.radians(angle))

Notice the variable angle is used as an argument to math.radians?

In the other code sample, counter is the variable, but it is never used. The value is ignored, and the important thing is that the code still generates 10 iterations.

Post a Comment for "New To Programming And I Am Having A Conceptual Block With The Range Function (explicit Values Versus Iterations)"