Lecture Materials

Questions & Answers


Q: I’m still a little confused when to turn bit left opposed to right. Can you please briefly go over that? :) I seem to get them confused

A1:  Great question! Bit has a direction. It has legs and eyes. The direction of the eyes and legs indicates which direction Bit is facing. I find it helpful to turn my body to face the direction of bit and then physically turn to the left or right in the direction that I want Bit to turn. Please follow up with more questions if you have them or swing by LaIR tonight to get help! This is an important concept :)


Q: For trouble with homework, Lair would be the best place to get help right?

A1:  Yes! Open tonight from 7-9pm PT


Q: my computer won’t open bluebook, how do I change the security setting?

A1:  Can you post on Ed, email the head TA Tara, or swing by LaIR tonight (open from 7-9pm PT)? I want you to get help but it’s hard to know the issue without seeing it :)


Q: How many questions can we expect on the quiz?

A1:  We cannot say unfortunately


Q: My blue book says that the developer can’t be verified. I tried to open using the method on the website, but I still got the same message. What should I do?

A1:  Can you post on Ed, email head TA Tara, or swing by LaIR tonight (open from 7-9pm PT)? I want you to get help but it’s hard to fix without seeing the problem :)


Q: im not sure if this is just me but whenever i try to submit the practice exam in bluebook it says "connecting to stanford" and just gets stuck there

A1:  Can you post on Ed, email head TA Tara, or swing by LaIR tonight (open from 7-9pm PT)? I want you to get help but it’s hard to fix without seeing the problem :)


Q: follow up to the security question: nvm I fixed it

A1:  Yay! Glad you figured it out :)


Q: How do I use bluebook?

A1:  have you read through the handout on the class website? https://web.stanford.edu/class/cs106a-8/handouts_w2021/bluebook_info.html If you still have questions, please follow up :)


Q: Whats this operator again? **

A1:  Great question! That’s the exponentiation operator like 2^3 = 8


Q: How do you sign up for lair? Do you have to sign up before 7?

A1:  Great question! You do not have to sign up before 7 (although you can sign up as early as 6:30pm). https://web.stanford.edu/class/cs106a-8/restrictedSum/zoominfo.html This handout (Zoom links under handouts on the class website) gives detailed instructions.


Q: could we do int(8/2) to get 4?

A1:  Yep :)


Q: How long is the quiz tomorrow (in terms of how much time we will get to take it)?

A1:  That has not been announced yet. In the past the quizzes have been ~30 minutes long but that could change this quarter.


Q: For the quiz will we have to write the bit = Bit(filename) at the top?

A1:  Probably not. Typically that line is given for you :)


Q: what if the string has an odd number of values? what would the midpoint be then?

A1:  I believe it would round down because integer divison always rounds floats(decimals) down (aka truncates the number). So if the string has 7 characters, I believe the midpoint would be 3


Q: What is concatenation?

A1:  Great question! It means to link things together. So we can concatenate (or join) two strings together


Q: How many digits can the float store?

A1:  Google says 9 digits :)


Q: What happens when you try something like 2 % 8?

A1:  I tried a couple of values like this in the hack mode interpreter and it always returned the first number

A2:  2 % 8 returns 2


Q: is the else part necessary?

A1:  Good question! Yes, it is since the if code body does not end with a return statement you have to have an else to make sure that both the if and else code body does not run


Q: Can you explain why we have the empty string again?

A1:  Yes! Once a string is made, it cannot be modified (this is know as being immutable). Therefore, if we want to modify the input string (here we wanted to make the characters different cases) we have to create a new string to return because we cannot modify the input string. So, we create a new string and “build it up” with the characters that we want


Q: Do we need Lectures 1-8 for the quiz? Which lectures do we need for the "Sand" assignment?

A1:  Yes lecs 1-8 for the quiz. For sand I believe you need lecs 8-9 (the grid lectures)


Q: Is there any way we can access the ascii number of a character in python?

A1:  Ascii is a universal code across languages. You can get the values off an ascii table https://www.rapidtables.com/code/text/ascii-table.html


Q: when do we get to see other people’s bluecreen problems??

A1:  I think the art show will be in lecture on Monday (but for sure sometime next week if not Monday)


Q: Why is the ‘got’ and the ‘expect’ the same string on the results on the right?

A1:  Great question! The got column represents what the actual output of the program with your code was. The expect column represents what the answer should be. If your code works, the got and expect columns will be equal. If your code doesn’t work then the two columns will be different


Q: I’m having trouble with the homework that’s due this week, where are places I could reach out for help? Thanks!

A1:  So glad you are asking for help! You can swing by LaIR tonight. It’s open from 7-9pm PT. LaIR is the best place. Other resources would be Juliette’s or Tara’s office hours :)


Q: What does \n do? (In the example line = ‘123\n’)

A1:  It’s a new line character. It’s equivalent to enter/return on your keyboard :)


Q: Is this just a csv file?

A1:  Frequently you’ll work with csv (comma separated value) files. Here instead of commas we have spaces so it’s not technically a csv but very similar


Q: Wait what’s /n?

A1:  It’s a new line character. It’s equivalent to enter/return on your keyboard :)


Q: Where on our class site can we download python 3.9.1?

A1:  In the installing Pycharm handout on the class wesbite. In the first block labeled “Installing Python” you can download 3.9. https://web.stanford.edu/class/cs106a-8/handouts/installingpycharm.html


Q: Where will the quiz be posted tomorrow so we can access it? :)

A1:  It will be posted as an announcement on the front page of the class website. It will have info about the time and length and the link to download the Bluebook file


Q: how many bytes per image? by pixel?

A1:  Colored pixels are 3 bytes (one byte per color RGB). An image byte amount depends on the number of pixels in the image (like an 60x40 pixel image has 2400 pixel and then 3 bytes per pixel)


Q: In the quiz, we also cannot use variables etc on the bit section right?

A1:  Yes you can never use variables on bit problems


Q: Can you explain again what \” does?

A1:  We use it to inlcude a few special characters. For example, since quotes are used to represent strings, if a word has a quote mark (for example as an apostrophe) then you have to preface it with a \ to indicate that it’s not the end of the string.


Q: Can we use else with bit?

A1:  Yes you can use if and else with bit :)


Q: For the homework (say the one due next week and from now on), how do pre and postconditions work for those? Or do we no longer need to add them for our comments?

A1:  Great question! Pre and post conditions are great for commenting bit functions. After bit, the structure I use for my function comments is: a few sentences about the function’s purpose/functionality, what the parameters are (ex. n = an integer representing the number of letter to append), and what the return value is. If there is no return I’ll indicate that too


Q: what if you want to print the text “\n” and not the line break?

A1:  print(‘\\n’) (put another blacklash)


Q: How do you print something in pycharm?

A1:  Use you the print() function and you put what you want to print inside of the parenthesis. Ex. print(“CS106A rocks”) would print CS106A rocks into the terminal


Q: For homework grades, what is a check plus, plus, etc. in terms of a letter grade?

A1:  We intentionally use bucket grades to shift the discussion away from letter grades. Also, the exact coversion varies from quarter to quarter. Generally, a check plus equates to some form of an A


Q: If we have trouble with using Bluebook, is Lair a good place to go for help?

A1:  Yep! LaIR is a great place to get help with anything related to 106A programs/material.


Q: Technical question, can pycharm compile and run without internet?

A1:  yes!


Q: in what situation would you use end = ‘ ‘

A1:  We’ll see an example at the end of lecture :)


Q: so print sends it to standard output but return doesnt?

A1:  Print sends information to the user in the terminal and return sends information back to the function caller


Q: What happens if something goes wrong with our Internet/power/computer during the quiz? Or who should we contact and how?

A1:  Great question! Hopefully everything goes smoothly but if you encounter technical difficulties, email Juliette and Tara immediately (and personally I would take a picture to document it). At the end of lecture I will ask Juliette if private Ed posts are allowed during the quiz/if someone will monitor Ed during the quiz time.


Q: For the quiz can we use for loops? Or just while and if (but not elif)

A1:  For bit problems, you cannot use for loops or variables but you can use while loops and if statements. For all other problems you are welcomed and encouraged to use all resources you’ve learned so far (such as for loops and variables)


Q: ls and clear dont do anything for me it says these commands aren't recognized? Why?

A1:  mmm I’m not sure exactly why without seeing it. Can you double check that you are typing inside the terminal (and not say the Python console)?


Q: is open similar to freopen in c++?

A1:  Based off the man pages it seems like it but I haven’t personally used freopen


Q: what are the controls for terminal? how do i leave and enter a file? I am stuck in my pycharm intro folder

A1:  When I get really stuck in the terminal, I close the terminal (on the upper part of the terminal there’s an x next to the local). Then you can click terminal and open a new one

A2:  https://www.techrepublic.com/article/16-terminal-commands-every-user-should-know/ This link describes some common terminal commands (way more than will be covered in this class)


Q: will we have any way to debug in the quiz?

A1:  For Bit and images, draw pictures. For functions/strings walk through my code with a tiny example.


Q: For the graded homework, is our grade supposed to show up on paperless?

A1:  After you meet with your SL for your IG your grade will show up on Paperless


Q: When you open a text file with terminal, does it open in vim?

A1:  You can open it in vim but what we did today does not open in in vim


Q: can you show the crazy cat again ?

A1:  Sure :)


Q: in pycharm, just for my knowledge, how would I use print instead of a doctest?

A1:  You can use print statements to looks at variables values at a certain point and doctests to automatically check your function outputs. Something to keep in mind is if you have extra print statements you will always fail your doctests


Q: What should we do to prepare for the quiz and do you have any advice on what to focus on? Besides rewatching lecture 1-8 :)

A1:  Checkout all of the problems on the Quiz 1 Review handout. Working through those are the best way to study :)


Q: What should we do if we missed IG sign ups?

A1:  Email your section leader.


Q: It’s helpful when the lecture recordings also record the Q&A so if we are not watching live we can still hear the questions. Is that a possibility?

A1:  Yes! Checkout the lecture tab for each lecture to see the QnA


Q: When do we start the quiz again?

A1:  The quiz 1:30pm PT tomorrow. Click the link on the website.


Q: When I try to submit my practice bluebook assignment it gets stuck at a white screen saying "Connecting to Stanford". Any tips to help?

A1:  There is no way to submit the practice quiz. You will be able to submit the actual quiz.


Q: who grades our quiz?

A1:  The section leaders :)


Q: A small tecnical question. I didn’t install mic and camera on my pc yet. If I plug my head phones will that work as mic? because I want to go to LaIR for help but I only installed pycharm on my pc not my mac. Thanks!

A1:  You don’t need a camera for LaIR but you do need a microphone and speaker (or headphones). If your headphones have a mic they should work


Q: Do we have to connect to this zoom class tomorrow for quiz?

A1:  Nope. No need to connect to zoom tomorrow.


Q: do we need to come to zoom when taking the quiz?

A1:  Nope :)


Q: I've emailed Tara about taking the exam on diffrent hour (because of time zone issues). She said Ok so should I wait for a mail before the exam or do something on app?

A1:  Tara will get back to you.


Q: Do you have to budget time to submit or can you submit once time is done.

A1:  No, once you start submitting your time stops


Q: I am not sure if you answered this already but do we get our grade for the first assignment when we join the IG meeting?

A1:  You will get your grade at the end of your IG


Q: Where do we find the quiz?

A1:  Tomorrow there will be an announcement on the front page of the class website


Q: what is the grading scale for the homework, i dont see a number grade?

A1:  Checkout the General Course Information handout for details on the grading scale


Q: When will our grade for the quiz be posted and will we know what we did wrong (if there is a solutions key)? :)

A1:  End of next week.


Q: Do we need to comment when answering questions on the quiz, or can we simply code?

A1:  No need for comments on the quiz


Q: If I got a check plus on the bit homework, is the 2% factored into that?

A1:  That is added on at the end of the quarter. Check plus is your raw score.


Q: Just curious, were any plus plusses given out on the first hw assignment?

A1:  No. Juliette has only seen 1 in her tenure at Stanford


Q: Are the questions multiple choice or can we write our own code to answer the questions?

A1:  You write your own code!


Q: For the bit quiz problems, can we see where bit is moving around the screen?

A1:  No. But there will be a pre and post picture