![]() ![]() |
| |||||||||
| This page removed for FERPA compliance | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| It means not equal to. The oposite of ==. -Student2081 |
| I can't, sorry. Student1919 |
| Ya. Why? :) Student1919 |
| gets the pixel at a specific location of the bigger picture on the right, do you know where it's telling you to go though? Student1919 |
| What specifically do you want to know? Student1919 |
| Question number 2 is a simple copy function that copies the smaller picture into the larger picture. The variables are named so as to obscure what things are to test whether you are able to trace a function. The task is to figure out where in the 5X5 image the 3X3 image is getting copied. Student1594 |
| The x and y values are variable. They are defined in the 2 for loops. They each range from 1-3 since the range goes from 1-4. Student1594 |
| x+2 and y+1 are the coordinates on the 5X5 image that you are going to color. You get the color from the x,y coordinate of the 3X3 image. The function is not averaging colors. Where in the function do you think that it is averaging colors? Student1594 |
| The answer to REMOVED is a 5X5 grid as shown. The different colors are black and white. This pattern is REMOVED complicated than you are describing. Student1594 |
| Try writing down all the variables and what the represent. Then step through the function one line at a time and continue to keep track of how your variables are changing. The names of the variables is irrelevant. If you simply trace the function a line at a time you should be able to better understand what it is doing. Student1594 |
| It does not average anything. Where do you see in the function a calculation of average? Student1594 |
| 1 and 0 would not be an answer. The answer is either 1 or it's 0. The expression 1 and 0 would evaluate to 0. That is not the answer. Student1594 |
| Problem 2 is about tracing a function. You can find out how to do that in the designing and debugging chapter. Also, recognize that it is taking in two pictures and somehow ending up with one picture. You could infer that there might be some copying going on as in homework 2 and check the chapter dealing with combining pictures. There is no clear and specific answer to this problem in the book. You should trace it line by line keeping track of what all the variables represent. Doing this should lead you to the answer. Student1594 |
| The TAs have not abandoned you. We do have our own classes as well and are trying our hardest to help answer questions. Asking questions at the last minute is always a gamble as to whether someone will be available to answer them. In the future, try asking your questions a day in advance. Then you can be REMOVED sure you'll get an answer. Student1594 |
| Huh? Student1594 |
| The answers won't help you if you don't understand what's going on. If you think you have the answer and you would like to verify it, I'd be happy to help. Giving you the answer will give you a false sense of understanding what you are doing when you don't understand it. You can however easily get the answer to numbers 3 and 6 by typing them into JES and 4 and 5 you can easily find the answers in the lecture slides and/or text book. Student1594 |
| It is copying the 3X3 image onto the 5X5 image at a location that starts two spaces right and one space down. The entire 3X3 does not start out gray, so why would color it all gray in the 5X5 image? Student1594 |
| why would you color the entire 3x3 gray? What are you doing to transform the 3x3 picture? Student1919 |
| It has been explained that you are copying the 3X3 picture onto the 5X5 picture in a certain location. All you need to figure out is what location it is copying it into. Student1594 |
| The 1,1 spot is supposed to be black. But if you're interpretting it as gray, then yes, you are correct, getColor(riboflavin) would be gray. Student1594 |
| Riboflavin is a pixel from the soybean image which is the 3X3 image. benzoate is a pixel from oil which is the 5X5 image. Student1594 |
| Yes. Student1594 |
| You are supposed to start with line 1, and determine which image soybean and oil are referrencing. From there you go to line 2, and figure out which range x goes over. It starts at 1, and goes until the width of soybean, which is one of the pictures. You've determined which picture it is from line 1. Then line 3, you determine the range of the y loop. Then line 4, you get the pixel from soybean at x and y which are the first values that x and y are assigned to in each loop. Then benzoate is the pixel from oil gotten at the location referrenced by x+2,y+1. If you know what x and y are, you can figure out what x+2 and y+1 are. You get the color from the pixel you've determined is represented by riboflavin. They you assignm this color to the pixel represented by the variable benzoate. Then you loop back and readjust your x and y values based on the for loops and continue until you've ran through both loops. When you are done with this, you will see the final result. Student1594 |
| The answer is C when I run the function. Are you sure you ran it correctly? Student1594 |
| That would be correct Student1594 |
| The answer is either 1 or 0 representing what the statement evaluates to. Student1594 |
| You must be typing something wrong. What does your code look like and what are you typing into JES? I've had someone run it on both the Mac and Windows version. Both give answer C. Student1594 |
| According to the book: "You start out be developing a list of requirements: What needs to be done, in English or math that can be iteratively defined" Student1594 |
| Read answers to other people's questions. If you have any specific questions that have not been answered, let me know. We've already given a general idea of what to do. Student1594 |
| You are trying to call removeGreen(picture) but if you look at the function definition, it says def removeGreen(). Notice that there are no parameters in the function definition. Therefore, you are trying to call the function with a parameter when it is expecting no parameters. Any parameter you tried to send into this function would be a parameter of an invalid type since the function takes in no parameters. Student1594 |
| I'd have to see it working. Are you being careful to pick a picture file when you do pickAFile? If you picked a file that wasn't a picture file, you would get this error on the picture = line. Student1594 |
| REMOVED the FAQ. Student1594 |
| setColor takes in a pixel, not a picture. Also your description of the loops is backwards. You go through the REMOVED indented loop first, so you go through all the y's before moving to the next x. The result in this instance will be the same reguardless, but it is not always. Otherwise, your explaination is correct. Student1594 |
| It compares 5<10 and says true or 1. Then it compares 3>8 and says false or 0. It will then compare the 1 or 0 from those two expressions and give 1 since 1 or 0 is 1. Then it will compare 1!=3 and that's true since 1 isn't equal to 3. So then it will compare 1 and 1 and give you 1. Student1594 |
def removeGreen():
for p in getPixels(picture):
setGreen(p, 0)
>>> f=pickAFile()
>>> picture=makePicture(f)
>>> removeGreen(picture)
A local or global name could not be found. You need to define the function or variable before you try to use it in any way.
>>>
| Also, make sure you load and save your file before you try running it. If you do not load it, it will not know what removeGreen is and will give you the local or global variable name error. The question specifies that the function is loaded before it is run. This might be why you are getting the wrong error. Student1594 |
| Without parentheses, and and or are evaluated left to right with the same level of importance like plus and minus. To clear confusion, the practice quiz uses parenthese to specify. 6>8 or 8>10 would give 0 since both are false and 0 or 0 is 0. Then 5==5 would give 1 and 0 and 1 would give 0. There isn't anywhere in the book that covers this specifically. Try typing things into JES and seeing what it gives if you want to test yourself. Student1594 |
| Also notice I used == and not just =. = is not a boolean operator and so does not evalute to 1 or 0. Student1594 |
| Tomorrow's quiz will be very similar to the pre-quiz in concepts and ideas. The questions will be different. Compare quiz 1 and prequiz 1 for an idea of the similarity level. Student1594 |
| Because you are not sitting the 3X3 in the bottom right corner. Student1594 |
| Some people find some things REMOVED difficult than other people. Please be constructive with your posts. No one is being helped by others telling them that what they find hard is easy to you. Student1594 |