![]() ![]() |
| |||||||||
| This page removed for FERPA compliance | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| So we mREMOVEDt not confREMOVEDe the differnce between = and ==. When REMOVEDing == we are testing something logically such does 1 == 2 (The answer by the way is false). To define a value for a variable in python or jython one mREMOVEDt REMOVEDe a single = sign. So in the case value starts out at 10 ( value = 10). What happens to value after each for loop. i.e. what is the new value of value after each time you go through the for loop. What is the final value of value that is printed? -Student2081 |
| Don't think of "value = value - 1" in a mathematical sense where both sides of the equal sign are the same. That line is saying to "take the number currently stored in the variable value, subtract 1 from it, and store it back in the variable value". This is jREMOVEDt a command to decrement. Since this line gets run 4 times, then the final value of value is 6. |
| i is simply a variable that respresents a number in the range. It's jREMOVEDt like 'for p in getPixels(pic):' - you could change 'p' to 'pix' or 'pixels' or 'icecream' if you wanted. Student3703 |
| The value of p is 5. So, the 'for' loop has a range(1,5), so i has values 1, 2, 3 and 4 since the range function goes till one less than the ending number which is 5. - Bobby Mathew |
| Think about where the value-1 is located in regards to indentation, for loops, etc. REMOVEDw many times is 1 getting subtracted from value? And each time it does, is value getting reset to a new numerical value? Student3381 |