Lecture Materials

Class Announcements

The first in-class quiz is on Friday. Checkout recent announcements on the home page of the course website. If you have a class conflict or a time-zone conflict, please email Juliette. Please make sure to have downloaded and installed BlueBook, our exam platform.

Questions & Answers


Q: Will we be able to run the code we type in BlueBook to see what the output looks like while we are still writing it?

A1:  No you cannot run code in BlueBook during the quiz.


Q: Will there be assignments other than the quiz this week?

A1:  Yes! An assignment comes out tomorrow and it will be due Weds next week.


Q: Is the quiz open note? As in, is it acceptable for us to refer to lecture notes as we take the quiz?

A1:  Yes! The quiz is totally open note. You can consult any materials. However, you may not collaborate with anyone, nor post any questions online etc.


Q: where can we find the quiz link Friday?

A1:  It will be on a course announcement on the home page of the cs106a website.


Q: Can we take the quiz later than 2:45pm, say 3:30pm?

A1:  If you can’t take it between 2 and 2:45 due to a class conflict or timezone issues, please email me asap and we can work something out.


Q: How many questions will be in the quiz?

A1:  3 questions.


Q: so we won't know if our code is working bc we can't run it, right?

A1:  You won’t have confirmation that it runs the way that you hope it does.


Q: Can we even consult with prior homework problems that we have submitted or prior lecture notes/completed problems from prior lectures?

A1:  Yes!


Q: will the quiz only be open from 2-2:45?

A1:  If that time doesn’t work for you, email me.


Q: The homework seems to have comments on the functions already, and it also won’t let me save the comments I put in. Does this mean that we don’t need to put any comments on the homework this week?

A1:  We do want you to put comments in the hw for this week. Please replace/update the comments that are in there. This is most important for part 2b.


Q: when do the first IG signups go out for week 1 assignment?

A1:  They should have already gone out. Reach out to your section leader to check in about this.


Q: Will we need additional time before we start the quiz to download BlueBook?

A1:  You can (and should) download BlueBook as soon as possible. On the day of the quiz, you will only need to download the exam file.


Q: The quiz is 15min, does it close automatically at 15min, or do we manually submit it?

A1:  It will automatically start the submission process after 15 minutes. You will need to hit a few buttons to confirm the submission.


Q: Which file do we turn in to paperless for homework 2.2?

A1:  image-grid.py


Q: on the quiz, do we need to write the setup piece, the bit=Bit.filename stuff?

A1:  nope you won’t need to do the setup stuff like that.


Q: so we are supposed to put in our own comments for homework 2b? Do we always put our own comments for every assignment?

A1:  Yes please! And yes, please comment every function in every assignment.


Q: are there any elements from HW2 part b on the quiz given pycharm isn't on the quiz?

A1:  Yes! Images are on the quiz, but nothing specific to pycharm.


Q: if we accidentally submitted our homework but we wanted to make another change, can we resubmit it until the deadline?

A1:  yes!


Q: When I try to download BlueBox, it wont let me open it. I am on a Mac and I tried the solution strategy to fix this, but it didn’t work. Nothing even happens. How do I fix that? Thanks!

A1:  Email me pls :)


Q: during the quiz, can we look at out previous homework/class work?

A1:  Yes


Q: how do we get to paperless

A1:  cs198.stanford.edu/paperless or you can click the links at the bottom of the homework handout for 2b


Q: Is today’s lecture material coming on the quiz?

A1:  Grids will not be, but functions are.


Q: It looks like the pictures for the bit example on the quiz information page are broken

A1:  Thanks for letting me know! I will work on fixing this


Q: What is Bluebook?

A1:  It is a software that was developed to take comptuer science exams on a computer rather than hand writing them.


Q: Is homework 2b meant to have our own comments in too or is it ok to just submit the code?

A1:  Please add your own comments.


Q: until which lecture should we study?

A1:  Up to and including the first part of today’s lecutre. (Grids will not be on the quiz which is the second part of the lecture today).


Q: How do I run my code in the PyCharm? I can’t see my output when I click run…

A1:  You want to type the commands on the handout into the terminal. Please reach out on Ed if you want more clarification on this.


Q: Is the quiz time window in PST?

A1:  yes!


Q: would it be possible/preferable to use if/else instead of the previous strategy of using one if and then just putting in another command below because it covers everything but the if?

A1:  I missed this I am sorry. Can you post on Ed or email me?


Q: You said "please comment every function in every assignment.". I thought last time Nick said we should only comment when it is not obious what the code does, and in general we want to only put meaningful comments where required. Could you please clarify

A1:  yes! I agree with the meaningful comment advice, and I think that there can be meaningful and informative comments to every function that you write. They don’t have to be long comments.


Q: by default does var i always start from 0?

A1:  in for i in range(some_number) i will always start at 0. We are going to learn some variants of this later in the quarter to make i start at another value.


Q: To submit homework 2b we only need to have the code for draw_image and make_channel, correct? Also, do we delete the comments (since the instructions ask so)? Thank you

A1:  Correct and yes delete the comments that aren’t necessary and add your own comments or add to the function comments describing each function.


Q: couldn't you do that without else

A1:  Which one?


Q: Why does he type += for the result?

A1:  '+= is the same as result = result + s[i]


Q: why was it += and not ==?

A1:  result += s[i] is the same as result = result + s[i] == checks if two values are the same.


Q: what is += means, why is not just =?

A1:  result += s[i] is the same as result = result + s[i]


Q: How often do we have quizzes?

A1:  There are a total of 3 quizzes spread out throughout the quarter


Q: When we submit HW 2b, will we be able to see/check if we sent the correct code/file, image-gride.py, on Paperless?

A1:  Yes!


Q: The d if it is digit and x if letter.

A1:  Sorry I missed that. can you post on Ed or email me?


Q: Is a comment to the code the text we write in triple quotation marks or the text we write after hash tag ?

A1:  both! They are both ways to tell the computer to ignore that line (or multiple lines).


Q: Will the quiz include information from section 2?

A1:  Yes! Everything besides the grids section on section 2 is preparation for the quiz. (Don’t worry about is_even and is_prime. Those have a few things we haven’t covered).


Q: Do we need to write comments for 2a?

A1:  Yes please


Q: downloaded str1, but the interpertor does not work, anyway, we can fix this?

A1:  Hmm, can you post on Ed or email me?


Q: do you always have to write the test cases with triple quote comments?

A1:  Yes!


Q: Why didn’t we define function digits_only in this problem?

A1:  That is the name of the function we are testing. So we are inside digits_only working on defining it.


Q: why do we need the >>> instead of just calling the function?

A1:  That is just special to doctests. It means “hey I want to test my function instead of run it”


Q: Why does the test return 43?

A1:  The example is supposed to return 43, but there are some bugs.


Q: How does this test know the expected value?

A1:  You type in the expected value. So when you write the test, you write the expected value.


Q: how does pycharm know we're expecting 43?

A1:  We write it when we write the test. On the line after the >>> line you put the expected result.


Q: you can also test the function in the python console right?

A1:  Yes! but you will have to retype your function into the console


Q: when should we write doctests? in real life coding too?

A1:  yes! People write them in real life coding too.


Q: so how and where do we actually write the tests?

A1:  In the comment for the function. So: def name_of_function(a, b): “”” Here I am describing the function. >>> name_of_function(a, b) ‘this is the expected result’ “”” # code for function goes here


Q: the movie.zip link isn’t working

A1:  Sad. I will work on it.


Q: is grid like an array?

A1:  It is similar!


Q: The movie.zip link takes you to a page that says “Object not found…”

A1:  Sad. I will try to fix


Q: movie.zip also isn’t uploaded I don’t think

A1:  Sad. I will try to fix


Q: How do you get to the doctest feature on Pycharm?

A1:  You will practice in section this week! but here is how to create a doctest. Then to run it, you right click the >>> and hit run doctest def name_of_function(a, b): “”” Here I am describing the function. >>> name_of_function(a, b) ‘this is the expected result’ “”” # code for function goes here


Q: does movie.zip say object not found for anyone else

A1:  Sad. I will try to fix


Q: movie.zip leads to a broken stanford page

A1:  Sad. I will try to fix


Q: When I try to download movie.zip, it says the object is not found

A1:  Sad. I will try to fix


Q: is the link updated for Movie.zip — I’m getting an object not found error?

A1:  Sad. I will try to fix


Q: Why does the code include grid.width, but not grid.height?

A1:  I think in this example we are only looping over the width


Q: can you ask the professor to slow down please

A1:  I will for sure give Nick this feedback. In the meantime, feel free to rewatch the recording! Also come to office hours for more practice with this stuff. I know he is moving super fast. As an aside, we don’t expect you to leave lecture fully understanding everything. We just want you to know the main ideas and then you practice them in section and with your homework.


Q: how much of the total grading are quizzes worth?

A1:  The combine quiz score is 40% of your grade.


Q: do you know any languages other than english and can we pose questions in those languages if so

A1:  I wish !! Sorry :(


Q: when i tried to download movie.zip, i get no object found

A1:  Sorry about this.


Q: Why are we putting ‘a’ in four boxes?

A1:  That is just part of the problem statement.


Q: Please don’t apologize for the movie.zip stuff not working! All good

A1:  :) I appreciate your kindness


Q: can you learn french so i can practice my french while posing questions here

A1:  I speak a moderate amount of french. Fun fact: my parents live in France and I lived there for 6 months in 2019. We can try french.


Q: why do we use y and not grid.height?

A1:  We want to do things are varying y values.


Q: *Sorry, I meant: wouldn’t Nick have to create a grid at the start of that function?

A1:  It depends if grid is passed in as a parameter.


Q: do we have grids in the quiz?

A1:  No grids on the first quiz :)


Q: could you also do for y in range (gridheight) for x in range (1) grid.set(x,y,’a’) for x in range (image.width-1, image.width) grid.set(x,y, ‘a’) to put a’s in the left and right edges?

A1:  I think that would work. Once we get the download working properly, you can try it out!


Q: Why did we do grid.width-1 instead of x?

A1:  To get the right most box.


Q: what is the significance of "Grid.build" having a capital G?

A1:  We will learn more about this at the end of the quarter, but it is similar to bit=Bit(filename). Grid was built by Nick and has a bunch of handy functions that you can use.


Q: Sorry that I still can't download the "movie.zip" thought window

A1:  I don’t think I can fix this until after lecture.


Q: Are we testing the for loop for set_edges()?

A1:  we are testing the whole function.


Q: will doctest be on Friday's quiz?

A1:  It is fair game for the Friday quiz. You will get practice in section this week!


Q: why does he have grid.set(0, y, 'a') again? what values are those representing? what piece of the function is telling where to draw the a ? thanks

A1:  That is saying put the value ‘a’ into the grid at the location 0,y


Q: do we always have to put the doc test lines within a comment?

A1:  Yes


Q: why did Nick build the doc test with ‘b’ and ‘x’?

A1:  Just for fun. You can do it with any letters that you want.


Q: Why did he put b’s and x’s in Grid.build?

A1:  Just for fun. You can do it with any letters that you want.


Q: If we are testing the whole function, why do we set a literal? Does the literal not have a different desire output than our function?

A1:  You function has to return what is inside the literal


Q: ah d'accord! ca c'est bon! super! je vais essayer poser mon questions de la futur en francais! but i only know a moderate amount myself, un peu, donc peut-etre you'll get a random french question once a week lol

A1:  parfait.


Q: Whereabouts in France did you live Juliette??

A1:  Paris !! Best city ever


Q: how do we download bluebook

A1:  Checkout the Downloading BlueBook handout


Q: where is the study guide located?

A1:  Quiz #1 Info handout


Q: How do we submit HW 2b?

A1:  Click the link at the bottom of the handout->submit assignment (in the top right) drag image-grid.py into there.


Q: Is it possible to have email notifications for when things are posted on the CS106 page? Like when there are announcements on Ed?

A1:  I am not sure if we can do this, but I will look into it.


Q: if we turn on hw on Fri night, is there a penalty?

A1:  If it is by 11:55pm, then no


Q: what is the definition of a doctest again?

A1:  Checkout the lecture notes / section this week!


Q: how long is the quiz and how much time do we have to complete it?

A1:  3 questions in 15 minutes


Q: is this going to be fixed soon?

A1:  live answered


Q: For the quiz, is the the same zoom link?

A1:  live answered


Q: roger that . thanks

A1:  live answered


Q: thank u queen xx

A1:  live answered


Q: yes, for the movie download

A1:  live answered


Q: python doesn’t recognize >>> for me. am i missing something?

A1:  Post of Ed


Q: Are there any deductions if I submit on Friday night?

A1:  live answered


Q: Will there be a timer on BlueBook?

A1:  live answered


Q: So will it auto-submit after the time is done or should we manually do this?

A1:  live answered