Lecture Materials

Questions & Answers


Q: Will ethics be on the quiz?

A1:  No it will not but it will be on your homework :)


Q: Will we still have lectures the days following the quiz?

A1:  Yes! No lecture on Monday but yes on Tues, Wed and maybe Thurs


Q: Will the following weeks HW be lighter because of the quiz?

A1:  No more required homework after assn 6 :)


Q: Should we expect every single concept from 8-23 to be touched on the quiz?

A1:  Yes! Quiz review materials will be touched on soon


Q: Will we have to show up for Zoom on Monday?

A1:  No just take the quiz :)


Q: Will it cover ethics as well?

A1:  No, ethics will not be on the quiz


Q: How do we submit our project for the competition? The sheet says paperless but I do not know how to submit it there.

A1:  I don’t think the assignment to submit it on paperless has been created yet but it will be soon :)


Q: is the quiz more points or are the questions on the quiz less points?

A1:  This quiz will be worth 20% of your grade. The exact breakdown on the points on the quiz will not be announced before the quiz is released


Q: Is the square O(logn) or O(n)?

A1:  O(n) I believe because appending is O(1) and the for loop is O(n)


Q: Just to confirm but the material from today and onward will not be on the quiz, correct?

A1:  Correct :)


Q: How many questions are on the quiz? If we're not allowed to know, would it be smart to estimate that there will be a question covering each major topic we've discussed?

A1:  We don’t announce that but yes, I would assume that each big topic will be tested


Q: What are the best lectures to reference for HW 6?

A1:  HW 6 is kinda like a capstone project! It covers dictionaries and drawing primarily but lists, strings, and file reading are also covered. So, any of those lectures with a focus on the dictionaries (especially nested dictionaries) lectures


Q: Can you also add a condition to the list comprehension?

A1:  Great question! Going to cover it soon :)


Q: Will it create a list if you use it on a tuple?

A1:  Yes it will :)


Q: does ** basically do a for loop and multiply n by a number of times or does it do recursion and each time it calculates n^(a/2) and then multiply the results?

A1:  Great question! I’m not sure, but will ask Juliette at the end :)


Q: How is our final grad broken down? What percent of it is homework, quizzes, etc?

A1:  Great question! You can find this information on the general course information handout on the course website: https://web.stanford.edu/class/cs106a-8/handouts/generalInfo.html Grading: 50% homework, 40% quizzes, 10% section participation


Q: Is it possible to solve all homeworks at once disregarding the deadline?

A1:  Can you clarify what you mean?


Q: If I haven't solved any of the assignments, could I do them all at once and submit them... let's say... tomorrow?

A1:  Ah I see. The late policy is that you get a 48hr grace period where you will not lose credit and then after the grace period, you lose 15% of your points each day. If you have extraordinary circumstances, you should reach out to the head TA Tara to see if something can be arrange for you


Q: Will certain questions on this next quiz cover multiple topics at once?

A1:  We don’t announce information like that. But I will ask Juliette at the end to see if there’s more information that can be shared.


Q: if we need to change the time for the quiz due to our time zone do we message tara or sarah?

A1:  Hi! Thanks for asking! If you need to take the quiz at a different time, please email the Head TA Tara :)


Q: Will we get a study guide for the quiz?

A1:  Yes! Quiz review material will be released on Tues or Wed


Q: Hi! Happy Monday! :) Can I use list comprehensions on what I have left on HW6?

A1:  Yes if you find a place but you can solve it without list comprehensions :)


Q: can example 2 be explained again?

A1:  Yes! We were looping over a string instead of a list. Whatever happens on left side of the for loop, it will add it to the output list. So we return a list of the characters in the alphabet


Q: Can you do list comprehension with other loops other than just for loops

A1:  You should only use them with for loops


Q: If i do not complete hw 6, how much will it affect my grade?

A1:  We have 6 assignments in 106A. The assignments as a whole are worth 50% of your grade (weighted towards the later assignments). What this means is that assignment 6 is worth more points (i.e. weighted more heavily) than say assignment 1. So at a minimum, you would lose 50%/6 = 8.3% of your grade but it would likely be more since every assignment is not worth the same amount


Q: I am not sure if this had been asked before, how do you initialize a list with a certain size?

A1:  Great question! In Python, we don’t have to indicate the the size of the list when iniatizing it. You can either initialize a list to be empty (lst = []) or have some elems (lst = [‘a’, ‘b’, ‘c’])


Q: if you go back to the hack mode interpreter, why did the conversion show a whole bunch of zeroes and a six following the decimal place instead of showing a decimal with one digit beyond the decimal?

A1:  Great question! This has to do which how floats are stored. Python doesn’t store all the numbers. So frequently when you do float math you don’t get exactly the number you want. Also, you can get random garbage numbers at the end. If you use round() you can include an optional parameters telling it how many places to round to


Q: How do we know when to use round, int or float, etc.? :)

A1:  Round does standard rounding, Int always truncates, and float is a decimal value. We will always tell you which one to use. If you are coding independently, you have to choose which one you need :)


Q: will our grade be effect on ethic part 7 if we created a problem that cannot be solved with our current skill

A1:  No, I don’t think so! We just want you to think critically about the ethics. But will confirm with Juliette at the end :)


Q: follow up question on list size. What if you want to access an element greater than its length? For example, if I want to have a segment tree, I kind of need the size to be 4n before I actually do anything.

A1:  mmm I don’t think there’s a way to do this but will ask Juliette at the end :)


Q: I am confused on round, int, and float

A1:  Thanks for asking for help! round() is a function that takes in a number and the number of digits that you want to round to and returns a number rounded to the correct number of digits. This function uses the standard rounding conventions (if last digit is less than 5 round down, if last digit is 5 or greater than round up). int is a type (like string). If you use int() to convert a float or string number to an integer than it will always truncate (or round down). So int(3.8) would return 3 float is the decimal type in Python. Please follow up if you still have questions!


Q: where is it useful to use list comprehensions?

A1:  Anytime you want a concise way to create a new list :) Will follow up with Juliette to see if there’s some specific examples that come to her mind


Q: What is Ethics part 7?

A1:  This question: “In 106A, we create clearly-defined assignments for you to work on. We tell you what to do at each step and what counts as success at the end. In other words, we are formulating problems for you to solve. As we discussed in class, however, problem formulation is one of the ways in which your choices as a computer scientist embed values. Formulate a different problem related to the topics of professor evaluation or visualization of gendered patterns in language use, ideally one you could solve with your current skills. Explain why and for whom it would be good to solve that problem.”


Q: How come we are doing functions we originally did in multiple lines in one now?

A1:  This is just another way to write code. Sometimes it is conventional in python to solve things in one line if you can. But sometimes it is better style to write a def and use multiple lines of code.


Q: Will the next quiz be open note? And when will the review materials be released?

A1:  Yes! The quiz will be open note! This review materials will be released on Tues or Wed


Q: Why does it print out the new list in all capitals?

A1:  Hi Mikhail! Can you tell me which example you are talking about?


Q: Could we also use name.endswith() instead of name[-1]?

A1:  In this case we could! But string.endswith() is a function that can take in more than one character so it’s a useful function to know. More info here: https://www.geeksforgeeks.org/string-endswith-python/


Q: I didn't really understand the Ethics-7 question. Could you clarify on what we're supposed to do?

A1:  Hi! Yes :) We want you to think of a problem related to the topic of professor evaulation or visiualization of gendered patterns in language use and discuss why it’s a problem and for who it would be good to solve the problem


Q: Hi! :) The one with the kids that end in ‘y’. It prints out ‘HENRY’, ‘AUDREY’, ‘BAILEY’. VS just ‘henry’, ‘audrey’, ‘bailey’

A1:  I’m not sure! I just reran the example and I got ‘henry’, ‘audrey’, ‘bailey’. I will ask Juliette to see if she did something different in the interpreter vs the answer key


Q: for pycharm, is it possible to solely edit code on pycharm and run on the default terminal app?

A1:  mmm I’m actually not sure. I’ll ask Juliette at the end :)


Q: next year 106a needa to provide a 24hr lair room where we can go and vent out our stresses about homeowork and how we don’t know how to do them when the debugging room is not open 😓

A1:  Yes!


Q: Can we use matplotlib for HW6?

A1:  Unfortanately no


Q: Say we want to try to attempt the extension for homework 6 but don’t end up finishing it by tuesday can we get partial credit or no? :)

A1:  You could submit it to the graphics contest instead :)


Q: What does it mean to make our own problem for Ethics-7? Do we make an ethics question or a coding question?

A1:  You can check in with Katie Creel (you can book a meeting with her). But we want you to engage with the material. You don’t need to code anthing


Q: So there is no extension for hw 6? It’s for tommorow?

A1:  There’s a grace period until Thursday Aug 5th like usual. An extension is taking the coding futher


Q: I’m still confused on Ethics-7 could you give an example?

A1:  Come to Katie’s OH or post on Ed with more questions about this.