Lecture Materials

Questions & Answers


Q: The free late days won’t affect my grade ?

A1:  nope!


Q: Will diagnostic grades be out today?

A1:  at the end of class!


Q: are the slides up on the website?

A1:  they are coming up soon (2 mins?)


Q: is there a grade incentive to not use late days?

A1:  none!


Q: will we still be getting an IG session for assn 7?

A1:  no, we only have IGs for assn 1 through 6


Q: do we get candy if we don’t use any late days?

A1:  haha yes! But more the metaphorical candy than the literal kind. But for what its worth, I think that not having used late days is an excellent strategy


Q: to use one late day you don’t need to do anything right, just turn it in normally but within the next 24 hours? Thanks.

A1:  thats right!


Q: who has individual office hours today?

A1:  I have group oh, and there is lair


Q: Where can we view our diagnostic grade?

A1:  we are going to release the link at the end of todays class


Q: when will the diagnostic grades be released

A1:  by the end of todays class


Q: Are the slides for today posted yet?

A1:  Just posted!


Q: Have the slides for this lecture been released yet? Or have they been released and my device is just being buggy?

A1:  coming soon!


Q: i joined late but did mehran say we can use two late days without penalty even if we already used them all up?

A1:  No.


Q: Are the slides frozen for anyone else?

A1:  thanks!


Q: Why can’t Chris and Mehran be instuctors for more CS classes (co-instructors)?

A1:  we love teaching together! Maybe one day. Its always so fun


Q: if i've already submitted my code on time today but I want to comment a little more can i resubmit it right now and not drop a grade bucket? I used all my late days

A1:  It would be after the due date if you submitted it after the 1p deadline


Q: pancakes or waffles

A1:  pancakes…


Q: Did Mehran help invent search engines?

A1:  youll hear the story! But he was one of the first people working on their ai team!


Q: can we still access this course’s material after the course ends ?

A1:  oh yea! We keep a version of the website here: http://web.stanford.edu/class/archive/cs/cs106a/cs106a.1212/


Q: If we did poorly on the first diagnostic but well on the second one, does the first diagnostic grade change?

A1:  Congrats! Thats an awesome sign that you have worked hard to master the material — which is our litmus test for grading.


Q: I have a random graphics question: how do we update the canvas? If we just do like canvas.create_rectangle, should it pop up or do we have to update somehow?

A1:  you dont have to update when you add a new shape, but if you move one, you need to call update


Q: Can you show us some past winning projects of the contest? :)

A1:  such a good question! We dont want to limit you in any way — but we can look into it


Q: For those of us taking the class pass/fail, what are the criteria for a pass?

A1:  We calculate a grade and anything C- or above -> a pass.


Q: How do you know your overall standing in the class?

A1:  We dont publish a “live grade” — but you can look at the grades you have gotten and try and imagine if you think those demonstrate mastery!


Q: What’s a good measure of mastery of 106A material to take 106B?

A1:  Good question! I think anyone who gets a B or an A is ready for CS106B


Q: How do I schedule an individual office hours meeting?

A1:  We have some already scheduled individual office hours (http://web.stanford.edu/class/cs106a/restricted/zoominfo.html). If none of those times work, send an email to mehran and I


Q: Does this use Markov matrices in any way?

A1:  good question! We aren’t going to do page “ranking” in assn7, which uses more math than we require for cs106a


Q: What kinds of research do CS people do in academia?

A1:  such a wonderful wide variety! Everything from new math for computers, to applications of AI to solve cool problems. Some folks work on computational - biology. Some folks work on inventing new computer human interfaces (imagine once upon a time, someone did research that led to the mouse…). The world of research in CS is as varied as the set of things that people use computers for!


Q: hi chris! can we come to group OHs if we wanna learn more about your research?

A1:  sure thing!


Q: if i do well on the assignments (check plus and plus) but score worse on the diagnostics, is it still possible to get some kind of A in the class?

A1:  certainly is possible. Have you thought about doing an extension for assignment 7?


Q: is it true building a search engine was once upon a time the final for this class?

A1:  Not that I know of — but this is a pretty fun final assignment :)


Q: How would you do the crawling?

A1:  import requests x = requests.get('https://w3schools.com/python/demopage.htm') will get you the raw HTML of a website! Then you can look for links and get that HTML.. and so on…


Q: If you are a frosh looking to potentially do CS as a major, would it have been better to get a B/B+ on CS106A or just get the Credit for CR/NC?

A1:  It doesn’t matter! Both grading basis’ will allow you to be a CS major


Q: Would it be unreasonable to aspire to get an A in 106b if we finish with a B in 106a?

A1:  absolutely not! Lots of students have done just that


Q: who came up with the idea of search engines?

A1:  mehran is going to talk about this history of search engines at the end of lecture!


Q: If we don’t feel super confident about how we’re doing after CS106A (online learning is hard!), what do you recommend we do over winter break to build a stronger foundation before taking more CS classes?

A1:  build something you find exciting using python! Practice is the best way, and your own project will be truly motivating


Q: Could I complete Assignment 7 with the lessons up to today?

A1:  yes! The extension will require material from wed


Q: or what problems were they trying to solve that showed need of a search engine? nowadays we cant image life w/o search engine, so I wonder how it all started!

A1:  the internet had just been invented and people needed a way to find the websites that people were putting up!


Q: Did the people who built Python code it in a different programming language?

A1:  yes! The core of python was written in a language called “c”. In CS106B you will learn the successor of that language “c++”. Good times


Q: Any reason the constant that contains punctuation is not in upper case?

A1:  It was from a really old python library! The style conventions for python evolved, but this constant is a remnant of an older time


Q: Wait when you're stripping the string of punctuation at the beginning and end, do you actually type "string.punctuation" inside the parentheses?

A1:  yes! Its a contstant in python’s string library


Q: I thought punctuations were commas, full stops, semi-colons etc

A1:  that and more!


Q: would a space also be removed by strip.punctuation?

A1:  no! good question


Q: this is a graphics question - is it possible to fill a shape with an image? (i.e. make my rectangle fill equal a burrito wallpaper instead of a color?) thanks!

A1:  Not that I know of. But you can add an image to a graphics program http://web.stanford.edu/class/cs106a/handouts/graphics-reference.html


Q: another graphics question - is it possible to wrap text, or is there an easy way to make a “text box” using tkinter or graphics class? thank you!!

A1:  https://stackoverflow.com/questions/11949391/how-do-i-use-tkinter-in-python-to-create-line-wrapped-text-that-fills-the-width good question


Q: is there a difference in the time it takes to look up an element in a short dictionary versus a really long dictionary? If there is, how do actual search engines return results so quickly?

A1:  Amazingly… no… it doesn’t matter how big a dictionary is, the lookup is always just as fast! Its thanks to a concept called “hashing” which you will learn about in cs106b!


Q: Will we learn how to build the user interface where users enter a query? Or will it be given to us like in Assn 6? I’m super interested in learning more about how the user interface works!

A1:  great question! The user interface for this assignment is a web page (written in HTML to be opened in a browser). I wrote up a UI for this, but put a ton of comments so that you could see how to write it yourself. Feel free to modify it :)


Q: If a document has more terms that are similar to those in the query, that document should be more important when it comes to ranking right?

A1:  that is a slightly more advanced version. In the next level of advanced you “rank” documents from most important to least important and return results based on rank


Q: What is Python used more for - graphics or non-graphics?

A1:  both! Its used for games, and for servers, and for data science + AI. Hard to quantify them all… I imagine at Stanford you will use it most for data science and AI. A lot of graphics is done by mixing python and C++


Q: random question, how often did people ask questions during the in person lectures for this class? i guess this qna feature is one of the cool things about this class being online

A1:  100%! In an inperson class we get through about 4-5 questions. online we get through hundreds!


Q: does this mean “we are yoda” should appear in that exact sequence in documents to meet the search? OR if a doc has 3 words anywhere in doc also in result?

A1:  the later


Q: Which notable programs/companies use Python mainly?

A1:  see last fridays class! Spotify, Google, a lot of games. Every AI company.


Q: is it good extension idea to set a threshold value of terms that should have an intersection. like in we are yoda we still give the result as 2 values have intersection

A1:  very cool idea!


Q: Wouldn't the search engine run better if it could find the file that contains the most number of words in the search query? Like for "we are yoda" can't it just look in docfile 1 since 'we' and 'are' are there?

A1:  that was a good idea that some folks tried! It turned out to be even more useful to sort results based on the “ranking” of a website!


Q: If a term is repeated multiple times in the same file, will that filename be put in the list multiple times?

A1:  no, just once!


Q: quick question. in what form do search engines store all our previous searches for the autofill function?

A1:  There is this truly cool structure called a Trie. Im not sure if thats what google uses https://en.wikipedia.org/wiki/Trie


Q: How would one use object-oriented programming to make a search engine? Will there be any opportunity for us to do this in Assignment 7?

A1:  Yes! There is an extension that will give you practice with this!


Q: where do you guys get these datafiles?

A1:  It was published with this research project Practical Solutions to the Problem of Diagonal Dominance in Kernel Document Clustering


Q: For the contest, if we’re doing something with animation, can we use the graphics.py from previous assignments to help create the canvas? or should we use something else?

A1:  Yes you can use that file! Great idea!


Q: How much more difficult is CS106B for the average CS106A student?

A1:  Most students who transition from CS106A to CS106B find it manageable. It is more difficult but you are also learning more!


Q: Are all the OH hours listed on the website until Nov 20th?

A1:  yes!


Q: This is soo cool

A1:  We are glad you are enjoying this!


Q: We literally did this in Math 51 last week

A1:  good times! They didn’t lie


Q: why couldn’t you just keep track of how many times the word appears in the document, and rank them by the that number?

A1:  people gamed that (very reasonable) approach. If you search for mehran sahami you want his home page (from stanford) not a page that writes his name 100 times :)


Q: Did Stanford get any money from Google (intellectual property stuff since Google was made on Stanford’s campus)?

A1:  satnford owned a small fraction of the patent.. which did end up being worth quite a lot.


Q: about the diagnostic - what if we did significantly worse in diag 2 compared to diag 1? how does this affect our end grade? also, can we make up for this low score somehow?

A1:  then we fall back to the typical grading policy. http://web.stanford.edu/class/cs106a/handouts/generalInfo.html You can write extensions for assing7 for extra credit!


Q: Coolest class EVER!! Thank you all SO much

A1:  live answered


Q: has any other recent company come out of Stanford since Google?

A1:  Instagram, Snapchat, a lot of smaller ones :) Stanford has a huge contribution to the economy !


Q: which math classes would you recommend for CS classes (AI, etc.)?

A1:  Linear algebra, probability theory, calculus

A2:  live answered


Q: Which series of classes are more helpful for CS? CME or MATH50 series?

A1:  live answered