![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Yes, any time return is placed within a function, the function will stop after seeing the return. |
| No. The answer is going to be the literal value or values that the function prints, not the names of variables. Ask the following questions: (1) How many times is the 'print' command going to be executed inside the function? The function is going to print as many numbers as there are executions of the print command. (Clue: For loops. Indentation....) Then ask (2) What the value printed is going to be each time? If you can't work this out, (3) type the code into JES, execute it, and then work out exactly why it prints what it does. You won't be able to do that in the quiz, of course, but it may help prepare for analogous questions. Colin Potts |
| If 'picture = makePicture(f)' works (i.e. 'f' is a picture file) why should there be a problem passing 'picture' as a parameter to makeSnazzy()? Are you bothered by the fact that picture is returned by the function? If so, you're on the right track.... Colin Potts |
| Yes, but where on the 5x5 picture? -Albert d'Heurle |
| Think about the definition of a for loop and how many times it will run depending on the value in the parentheses.Liz Helms |
| This is true, but is there an actual error caused by leaving return in this function, and why is/isn't this a problem? Liz Helms |
| click here,and scroll to the bottom of the page |
| yes. Where should the return be? -Albert d'Heurle |
| The print command in line 6 of the function. Liz Helms |
| That's right. It's a logical error, because the indentation mistake doesn't make the program invalid; it merely causes it to return too early and with the wrong value. Colin Potts |