Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Fall 2005 Homework 1 Questions


When I go to post my picture on the Fall 2005 Homework 1 Posters it asks for a username and password and I tried several different things and none of them worked. What should I do? - gtg365w
You can find the username and password you are looking for in the FAQ on the coweb Kelly Lyons

I am having trouble with the part of the homework that says "set the blue and green values of the pixel to the average of the blue and green values". Do we have to def an avg function for this? Does JES already have an avg function that we can call? Or is there a way to do this manually? Please help. Thanks.
You must calculate the average yourself by getting the values of the green and the blue components of the pixel and adding them and dividing by 2. For examples, look at the greyscale function from class. That is averaging 3 components. Use the same idea, but only average the two components, green and blue. Kelly Lyons


My homework works, but I am having trouble doing the extra credit part. I can't save the new picture I have created on to my computer for some reason. How exactly am I to submit my new picture?

Are you having trouble before or after the writePictureTo part? -Blake O'Hare

Do I need to include a function that makes a picture in the program, or can that be done in the command area separately? Also, do I need to inlcude the writePictureTo function in program, or can I just do that in the command area as well?

If I'm wrong, then another TA please correct me, but I'm pretty sure the TAs will do the makePicture() part in the command area before we run your code and you don't have to put that in. No, you don't have to include the writePictureTo(). We would actually prefer you NOT to because it won't run on our computer because the path name is specific to your computer. -poof #10

That's correct. Making picture and writePictureTo should both be done in the command area. Kelly Lyons

Blake, yes it's the "writePictureTo" part that I'm having problems with. My picture pops up on the screen and looks exactly how it is supposed to look, but I don't know how to save it to my computer so that I can post it for extra credit. What should I do?

After you call your program, take the picture variable that you passed in and send it to writePictureTo with a path and filename...
>>> colorEffect(picture)
>>> writePictureTo(picture, 'C:\\Documents and Settings\\you\\Desktop\\llama.jpg')
Something like that. -Blake O'Hare

I keep getting an error that says: An error occurred attempting to pass an argument to a function. Please check line 2. Line two is my for loop, and it looks exactly like the for loops done in class and in the book. What could I be doing wrong?

The problem could be where you're trying to create the picture. I'm assuming you have getPixels placed directly in the for loop syntax. getPixels would be the only instance of passing an argument to a function, so the problem is with the picture. Are you sure you're passing a picture and not a file to your hw1 function? -Blake O'Hare

How can I pass a picture and not a file?

It's a file that is a picture. Is there another way?

By "file" I mean the string that pickAFile() returns and by "picture", I mean the returned value of makePicture -Blake O'Hare

on a Mac, Im doing the extra credit part. How do I find the string when I writPictureTo a certain spot. For example I want to put it in my CS file. So how do I know what the string is for that file.Thanks

You could try using the pickAFolder() command to find what folder you want to put the file in. Then tack the desired filename on to that. -Blake O'Hare

i think i did something wrong to the picture posting page. sorry.

Fixed. Everyone, please be careful while posting. If the body of the page looks "odd" in any way before you add your entry, hit refresh, then add it. (Especially if you use a Mac or other non windows OS) -Blake O'Hare

If I put makePicture in my program, does it matter, or should I find some way around it?


NOOOOOO!!!!! The appearance of any of the following in your code will result in death:
  • makePicture
  • pickAFile()
  • show
  • repaint
  • writePictureTo
  • print
If any of those are used in your code, then you have done something wrong (unless you're using writePictureTo to make your picture into a file and have intention of removing it after you post to the gallery).
-Blake O'Hare

wait, i already included show at the beginning and then repaint at the end just to display that it worked...should i redo it and resubmit it??

Perhaps I was a bit harsh in my last statement. The following will result in your TA shaking his/her fist angrily at you:
  • show
  • reapint
  • print
However the following will still result in death harsh grading penalties:
  • makePicture
  • pickAFile()
  • writePictureTo
So for "show" and "repaint", it may not be necessary to resubmit, but it's probably a good idea. -Blake O'Hare

Show, repaint, and print are unnecessary. They exist for the purpose of testing your code. You add these to your program to make sure that it works, but you generally remove them before your program is final. If you left them in your program, it will not affect your grade. The reason makePicture, and pickAFile should NOT be in your function is because your function is supposed to take a picture as input. This means all the making of the picture will happen in the command area. If you are finding yourself needing to use these in your function, then you are not understanding the idea of input. Speak to a TA about this so that they can clarify things. Input is an important concept to understand. writePictureTo should not appear in your program because that will most likely cause it to crash when your TA runs it. Your TA will not have the same filepath on his computer that you have on yours and so it won't run correctly. This would cause you to lose points on your assignment. It is ok to put it in your program to get your picture saved on your computer. Simply remove it before you submit. None of this will cause your TAs to be angry or mean. We DO understand that some of these things might be confusing to some of you. If you are confused about any of this, please speak with a TA so that we can help clarify things. We're not as scary as Blake is making us seem. He's simply a bit overzealous. Kelly Lyons

Please still come to my office hours. :/ -Blake O'Hare

how do i resubmit my program through webwork?
Same way you turned it in the first time. It'll automagically overwrite your first submission. -Blake O'Hare

Should the function return(picture) be at the end of our program?
Yup. -Blake O'Hare

In my code, I don't have makePicture or pickAFile, but I did before and it ran fine, but now it won't run. Is there any reason why it is doing this?
What is the exact error message that it gives you now? - Jonny Aguillard

I wrote my code and it works just fine except i compared my picture to one of the TA's pictures on the post-it page and my color is slightly off. Instead of the whitish/pinkisk color, I'm getting cherry red...everything else it fine. Any idea where my problem might be?
Make sure that you are getting and saving your original green and blue values before you do any kind of comparrison. If you do not do this, your second comparrison between the green and blue will compare the new values instead of the original values when you want to be comparring the originals. Kelly Lyons

I'm trying to upload my picture to the picture gallery for extra credit, but everytime I click on attach, it prompts for a username and password, and i typed in my gth and my gth password, but it still won't work.
You can find the password you are looking for in the FAQ on the coweb. Kelly Lyons

How do I add a reference to my picture in the picture gallery?


do we have to use "==" in our program?
no, use <, >, <=, >=...if you see a necessity for ==, than use it, but i'm pretty sure you can write the code without it. Amanda Bennett

Do we need to include lines with the # sign to describe what the parts of our function do?

The # statements are mostly for your own reference so you remember what you did. Also if you worked with someone, it might be good to put who you worked with. If you email your TA with your code, it would be helpful to put in # statements to tell your TA which part of the code you're having problems with. Lulu Wang|

Is it alright to plate getPixels directly in the for loop syntax? My picture turned out fine, but I still get the error. Should I just ignore it?

I'm trying to add my picture to the gallery, and when I click on the attachments button it brings up a window that i have to enter my user name and password. I am entering my gtg# and corresponding password, but it isn't working. A few other students I know are also having this problem. What am I doing wrong???

Please read the FAQ.

My code is returning a number when I use it without show and repaint. Is this right?

where do i find the FAQ?

Main Page –> FAQ

what do we name our home work one to post on webworks?


It's written in the assignment what you should name it Kelly Lyons

Is it alright to plate getPixels directly in the for loop syntax? My picture turned out fine, but I still get the error. Should I just ignore it?

What is wrong with this code:
def colorEffect(picture):
  for pixels in getPixels(picture):
   redValue=getRed(pixels)
    if redValue > 128
     setRed(pixels,255)
    else redValue <= 128
      setRed(pixels, 0) 

It keeps telling me to fix line 4, but I don't know what's wrong with it?
COLONS! And the syntax for else is wrong. -Blake O'Hare

I've saved my Homework as colorEffect.py and submitted it but when I try to retrieve it, after it downloads and I try to open it to see it I get a messasge sayin it can't be opened because windows needs to know which program created it. Is that right, or should I be able to see the actual content of what I submitted?
This is correct. The .py file extension is not associated with anything so to view what you submitted you have to open JES and then open the file through JES Albert d'Heurle

I added return in my code and now when I run the function it gives me a line saying something about media instance but it doesn't actually show my picture. Is there an error in my program?
That is fine. Albert d'Heurle




Links to this Page