June 28th, 2021
Q: can you go over how to submit our homework please?
A1: live answered
A2: At the bottom of the homework handout there’s instructions :)
Q: Where can I find the zoom links for sections?
A1: You can find the links on Ed :) https://edstem.org/us/courses/6812/discussion/495013
Q: can you explain the 2% bonus on the homework? is it like basically two extra bonus points?
A1: Yes, it’s a 2% bonus. So if you got a perfect on your homework (we grade with buckets so this doesn’t super apply) you would get a 102% if you turned it in on time. It’s just a small boost :)
Q: Is it okay to submit multiple times?
A1: Yep! We only grade your last submission
Q: Why are we using '...' instead of "...." in Python.
A1: Both work in Python for strings
Q: and hw is graded on style and not efficiency correct?
A1: Homework is graded on both functionality (the majority of your grade) and style (a smaller portion than functionality)
Q: Do we have specific assignments that we need to complete for homework for our section?
A1: Section does not have homework. Your section grade is made up of attending section each week, participating in section activities, and attending your IGs
Q: sections are the same time each week right?
A1: Yes!
Q: Do we have to put pre and post condition comments on every line of code we write?
A1: Not on every line of code. Each function should have a comment describing what the function does and in this comment you could mention the pre and post conditions
Q: the for loops are interchangeable right? We could have the x loop be the outer loop instead of the y loop?
A1: Yes but it’s standard convention to do the y first :)
Q: For the homework, I am stuck at a place. I checked the office hours and Lair but due to large difference in time zones, I wont be able to attend that. What can I do? Can I email the code to TA and ask for assistance?
A1: You can also make a private post on Ed :)
A2: Great question! You can go to Tara or Juliette’s OHs. The times are listed on the website
Q: Is Y always the outer loop?
A1: Yes but it works either way
Q: how can we get access to the previous recorded class videos for non stanford students?
A1: This is a great question! Do you have access to Canvas?
Q: Can you explain again the difference between the first darker example (pixel in image) and this example with the nested loop (for in range)?
A1: For each loops (for pixel in image) and nested for range loops are both for loops that iterate over all the pixels in the image. For each loops do not allow you to access the coordinates of the individual pixels and nested for range loops allow you to access the individual pixel coordinates. You will use both types of loops at different times (the nested for range loops generally give you more functionality than for each loops)
Q: how would you write that in code? set pixel(x , y) = a?
A1: We’re going to learn about image.set_pixel(x, y, pixel) soon!
Q: unfortunately i dont. im currently in iran. i just want some how get access to the recorded videos and watch them im really behind i have to see the previous videos
A1: Can you email the head TA Tara @ tarabeth@stanford.edu? She’s the person who can answer this question
Q: What does “out.get_pixel” do?
A1: out.get_pixel(x, y) gives you the pixel at the given coordinate (here x, y) on the given image (here out). When you use nested for range loops you have to get access to the pixel at the coordinates
Q: so is pixel variable has the same address as the image?
A1: No, the pixel variable is one pixel in the entire image (which has thousands of pixels)
Q: in which part of the code is the image copying?
A1: mmm can you clarify your question?
Q: When we do assignments with images, should we use nested for loops or pixel in image loops? Are there situations we should be using one over the other?
A1: You have to make this decision on a case-by-case basis. In general, the nested for range loops give you more functionality so they can usually be used. For each loops are a “simpler” version of the for loop which can be easier to use but sometimes it cannot be used. You’ll probably use both on your homework.
A2: To follow up on this, when you have to translate pixel coordinates (shift pixels up for example) you generally have to you nested for loops because you need access to the pixel coordinates.
Q: tnx very much
A1: Of course!
Q: "out" is soley a variable that can be interchanged, correct?
A1: Yes, we choose the name out. You could name the out image anything like out_image, pizza etc. But you want to pick descriptive names so out is a good name
Q: Can the word “out” be anything we want as long as we keep it the same throughout our code?
A1: Yes! But you want to use descriptive names when naming your variables
Q: what di pixel_out = out.get_pixel(x,y) do
A1: When you use for each loops, the pixel variable gives you access to the pixel “automatically”. When you use nested for range loops, you get access to coordinates and then have to use this line of code to get access to the pixel at the coordinate.
A2: This line of code gives you access to the pixel at the coordinate (x, y) on the out image. Now you can manipulate this pixel by referncing it as pixel_out.
Q: how would you make a stripe proportional to the image i.e. 10% of the image.width
A1: You would have to manipulate the range of the for loops to only iterate over say 10% of the image.width. Ex. for x in range(int(image.width * 0.10)). the int() is to convert the float (decimal) value to an integer.
Q: is pixel_left a varaible?
A1: Yes! pixel_left was set to equal pixel_left = out.get_pixel(x, y)
Q: i emailed her can you please inform her that i did.
A1: Yes!
Q: Because of the time zone, if I cant attend Lair and I cant attend office hours, what other option can i take to get help for the homework?
A1: You can make a private post on Ed :)
Q: can you explain out.width - 1 - x, y again?
A1: live answered
Q: Why is the Y side not shifting for mirror?
A1: The height is the same for all the pixels (the out image has the same height as the original but twice the width). The width or x coordinate is the only coordinate that is changing
Q: if only the x moves why do we write x, y?
A1: Great question! We are setting a pixel at a certain coordinate location with the line pixel_red = out.get_pixel (out.width - 1 - x, y). We have to provide both an x and a y coordinate to “grab” a pixel
Q: Can we go over how to turn in hw once more, I joined like 2 minutes late, sorry.
A1: Yes! At the bottom of the handout, you hit turn in hw1 after completing the problems on the experiemental server https://web.stanford.edu/class/cs106a-8/sum-assn/homework-1-bit.html
Q: For the homework due tomorrow should we have pre and post conditions for all the bit problems? even for the easier ones like part a?
A1: Yes :)
Q: Where's a good place to get reference to SimpleImage, like the reference doc for Bit. Thanks! Hi Sarah, from your sectionee.
A1: Posting a guide later today
A2: Hello!
Q: Is pre and post condition the same as explanation of the code?
A1: Great Question! The pre and post conditions are great to have in addition to an explanation of what the function/program does.
Q: What happens if we don’t comment the homework?
A1: You can get a lower grade on style but also have a harder time referncing your code later. It’s a good idea to get in the habit of commenting your code early on.
Q: why is it one loop with left and right instead of two loops
A1: Come to office hours and we can chat about this :)
Q: if I’m really confused and need youtube vid help (just in case), what keyword should I search?
A1: function names are usually good ones
Q: If I already submitted my homework and go back and make changes, do I need to re-submit or will it save it automatically?
A1: Yes you need to resubmit every time you make changes
Q: for problems like big red s that already have comments should we add additional comments?
A1: You can, but you don’t need to.
Q: what if you have some comment that you can understand easily but hard for others to understand
A1: try to make it so your SL can understand your comments
Q: For keyboard shortcuts, how did you change a highlighted text into a # comment, and how did you shift a line of code left or right an indent?
A1: You can highlight the code and hit cmd + / (mac) or ctrl + / (windows)
Q: What is the difference between “”” “”” and #
A1: The “”” “””” is used for multi line comments and # for single line comments
Q: Is it okay if my pre and post conditions of each helper function are different but when I use them in the big function I have steps in between?
A1: yes !
Q: If my code has some extra lines like if bit.front_clear(): which may not be necessarily useful, is that okay?
A1: Usually we ask that you delete code that you don’t use or doesn’t do anything
Q: What lectures specifically cover the information we need for the homework (i.e. all of them, the first two or three, the recent ones, etc?)
A1: The first 3 lectures for homework 1 :)
Q: Can i use variable in the first assignment
A1: No variables in the first one.
A2: You also cannot use for loops
Q: Can we go to OH to talk about programming and things related to python but not specifically about something in the lecture? Thanks!
A1: We can chat about anything in office hours :)
Q: Could you clarify when the office hours are? Sorry I must have missed that
A1: Juliettes OH: Tu/Th 9-10:30am Tara OH: M/W 6:30-8pm Lair: M/W 5-7pm, Tu/Th 7-9pm
A2: Check the zoom info page for specifics.
Q: can you upload the recorded class on the mega instead of the canvas :D? someone like me can't access
A1: Follow up via email :)