![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Answers won't be posted. You can post the answers to the review questions on this page and a TA can tell you whether its right. Also, TA's will go over some parts of the review this week in recitation. - Bobby Mathew |
| Yeah, that should work for the tracing questions and some of the coding questions. - Bobby Mathew |
| Two separate points: First, the last two functions in "Follow the functions" had minor typos (the "for" lines didn't end in colons). You could really have found those errors and corrected them yourself, although you shouldn't have had to, and we will double check the actual test questions more carefully. Sorry! They are now correct. Secondly, some of the functions print values using "print" commands, and others just return values – the return value being printed in the command area as the result of the function. Review your understanding of the difference between print and return either by trying out the examples or looking up the topics in the book or sample code. If a function neither prints nor returns, then "nothing" would be a valid answer. That's not a trick question; plenty of functions (like many of the picture manipulation functions we have been writing) neither print nor return values. Colin Potts |
| Yes, there has to be a statement like that. Its a typo. I've changed it on the review page. - Bobby Mathew |
| 'count' is a just random variable to keep track of in the 'for' loop. You can name it anything you want. - Bobby Mathew |
| Same as answer above. Just a random variable, like saying for p in getPixels(picture), p can be any name - Bobby Mathew |
| Pure colors - Bobby Mathew |
| A color channel is the same thing as a color component. Every pixel has 3 color channels (RGB) and each channel is 1 byte in size. - Bobby Mathew |
| When x=y, the line is diagonal. Everything below the x=y line means that x values are always lesser than y. Try to base your 'if' condition on that. - Bobby Mathew |
| No, you're right. There's only one pixel to change but that doesn't satisfy the 'if' condition so in the end nothing changes. - Bobby Mathew |
| Just the simple way - averaging the rgb values and setting the rgb values to that average. - Bobby Mathew |
| For the interation a "for" loop is the correct answer. So now you need answer the question "What's the beginning of a conditional statement?". Any guesses? Toni Walden |
| Remember that a the names of a function's inputs are arbitrary and have nothing to do with variables in other functions that happen to have the same names. a and b are just the names of the two inputs to help1. Now, what two values is grover giving to help1? The first one is going to be called a inside help1, and the second one is going to be called b. Colin Potts |
| As for slimey, you can obviously ignore (i.e. delete or comment out) the a, b, and c lines inside the loop, since only d is returned, and d doesn't depend on anything else. Ok. d starts off with the value ..... what? (Hint: It's an input to the function). And each time through the loop it gets one larger. How many times is the loop executed? (Hint: range(1,5)). So it's that amount larger than it was when it started out.... which happens to be 9. You can use the same reasoning for harry. It looks a bit more complicated because some of what harry does is done by another function, help1, but that doesn't change anything really, and you should have been trying out functions in JES for the past few weeks. It will click eventually. If you're still confused after the test, you should see Cedric or me or your TA and go over functions and inputs so that it clicks sooner rather than later! Colin Potts |