Lecture Materials

Questions & Answers


Q: For milestone 1, are we supposed to use int or float or something else for the calculation since my percentage for both women and men is a percent higher? :)

A1:  From the handout: “Without getting into the math too deeply we note that given the amount of data we have access to, any number you calculate is likely to deviate by 1 to 2 percentage points.”


Q: In order to skip lines for the homework, should we use the lines[1:] or do we use next(variable)?

A1:  Great question! I believe you can use either on your homework :)


Q: For milestone 1, do we use dicts to count for man and women or just variables?

A1:  Great question! That is for you to figure out :) Please do stop by LaIR if you need futher homework help though


Q: On top of two of the py (I think it was biasbars.py and biasbardata.py) under the title (on the very top) it says “add comments here”. Does that mean we are required to write a general comment for the lab in addition to comments in each function? :)

A1:  Yes, if it says add comment please add an overall comment describing what the program does :)


Q: For the last problem on the warmups (previous_equal in dict3hw) I don't really see how to do the problem with a dictionary or why that would be beneficial. Is using a dictionary a requirement? Also, the problem references the "previous" strategy from a certain lecture, where can I find that?

A1:  You do not have to use a dictionary to solve this problem. You can use a variable. I know it’s confusing because it’s inside the dict warmups. I’m going to look for the previous strategy


Q: will JSON be on the quiz?

A1:  No it will not :)


Q: If there is a very long dictionary could you use a variable instead of data = ... ?

A1:  Can you clarify you question? data = is usually setting a variable.


Q: If we’re not stanford students, until when will we have access to the videos on canvas?

A1:  This is a great question that I do not know the answer to. I will ask Juliette at the end :)


Q: what does import sys do?

A1:  I know it’s imports some package/functionality but I’m not 100% sure what it imports. Will ask Juliette at the end :)


Q: Which lectures will be covered on the quiz?

A1:  Lecs 8-23 excluding software design (lec 16)


Q: Will this JSON manipulation be on the quiz?

A1:  No it will not


Q: for part 7 for milestone 8, can you maybe give some tips on picking a potential problem that we can solve with our current skills?

A1:  Hi! The handout says ideally one you could solve with your current skills. My suggestion would be to brainstorm some problems and solutions and then if you can think of a way to solve it great but if not that’s okay too. We want you to critically engage with this so we can’t really give examples. If you want to discuss the ethics portion in more detail, Katie Creel has office hours. Book here: calendly.com/kathleencreel


Q: Do we have to submit the rating stats file or just the biasbars files?

A1:  Yes, submit all three files. Any file that you modifiy should be submitted :)


Q: Is the Data visualization assignment extra? Or is it also homework?

A1:  All of assignment 6 is mandatory. The graphics contest is optional :)


Q: Do we have to do the extension?

A1:  Nope, that is optional


Q: for the ethics part (milestone 8) how many sentences roughly should we write? Is it 2-4 sentences per question like last time? :)

A1:  Yep! From the handout: “As usual, please take the time to seriously think about each of the questions presented below and answer each in at least 2-3 well thought-out sentences.”


Q: Will there be IG’s for hw 5?

A1:  Yes! Your section leader should be reaching out soon telling you to sign up :)


Q: Can we change the color of the graph?

A1:  Which graph?


Q: For the ethics part 7 question, do we actually have to solve the problem that we created? Is it possible to make an algorithm question that has a degree of ethics contents and is related to either professor evaluation or gender?

A1:  You do not have to do any coding for part 7. You also do not need a well thought out solution. The goal really is for you to think of a problem and discuss why and for who is would be good to solve. The solution is less emphasized.


Q: Can we change the color of the bars in the graphs from blue to something else?

A1:  Yes! You can add a parameter color=“color”. Thanks for asking!


Q: If we want to do the extension but won’t finish by today, you mentioned we can submit it as the optional EC semester project. Since we will get EC for the extension if we do it but for the optional EC semester project we will only get EC if we are the top 2, how does that work? :)

A1:  I believe there is a grace period for assignment 6 until Thursday at 11:55pm PT. So, if you could get it done by then, that would be ideal. But, yes, you’re right the homework has better odds of getting EC but the EC on the homework is way less than the EC on the graphics contest. Will confirm with Juliette at the end


Q: if there are not variable types, how do you make a variable to have a type of a class you defined?

A1:  Inside the class, there will be instance variables (talking about soon!). Please follow up if I didn’t answer your question


Q: Is the second handout for this homework optional? The guided extension part?

A1:  Yes, it’s opitonal


Q: Follow up question to the variable type question. I mean in c++ you can do struct var{}; and then you can initialize a variable var a; , if there are not variable types in python how do you initialize a variable with type that you defined?

A1:  Here’s my answer. Will follow up with Juliette at the end So Python doesn’t have explicitly typed variables and as a result you don’t “initialize” variables. If you want to create an object from a class and store it in a variable it looks the same as creating other variables in Python


Q: So.. Bit was an object?

A1:  Yes!


Q: Cool!!

A1:  Right?!?! So cool! I love this full circle part of 106A :)


Q: Is it possible to create a separate submission for the extension so I can submit the actual lab today on time for the 2% on time EC but the extension by Thursday? :) Currently I think they are the same submission

A1:  Hi! I don’t think so but will ask Juliette at the end :)


Q: did we ever initialize count to be 0?

A1:  Yes, in the constructor


Q: will oop be review in Lair?

A1:  Yes, you can come by LaIR to ask questions about oop :)


Q: Can instance variables only be created in the constructor?

A1:  No, but generally they are only created in the constructor


Q: Hi, I hope you are doing well! I was just curious… what are the advantages of coding using object oriented programming rather than our original imperative programming? Is object oriented programming considered cleaner code?

A1:  Great question! I don’t think that one is necessarily better than the other. I view them both as valuable tools in my toolbox. But will ask Juliette to see if she has a different answer :)


Q: is there a public/private method/instance variable system in python?

A1:  I believe it does not but will confirm with Juliette :)


Q: will the information from yesteday’s and today’s lecture be included in the upcoming quiz?

A1:  Nope! Only through Lec 23 :)


Q: what is an instance variable?

A1:  Variables associated with objects (and a class creates an object)


Q: How do you suggest we study for this upcoming quiz? Any tips? :)

A1:  Great question! My number one tip is practice practice practice! You learn how to code by coding. This is definitely a learn by doing subject. So when in doubt, do more practice problems. Past that, I like to make review/note/cheat sheets (whatever you like to call them) for each topic. On the sheet, I’ll put the common command, common patterns, and my common problems. So for images (which are not on this quiz), I would put the syntax for getting, setting, pixels but also the patterns of for each vs for range loops or how to reflect an image etc. Also, I frequently forget to minus -1 so I would make note of that. In addition, I think timing yourself is beneficial. The thing I found hardest about the quizzes was the time so getting used to coding in a timed setting without running my code was super helpful for me. Also, stop by LaIR to get any fuzzy areas clarified. Definitely solving a few problems each day is better than cramming 20 problems on Sunday so practice a little each day Good luck!


Q: how do you compare two classes?

A1:  You have to write your own comparision function :)


Q: what is the difference between set_units and incriment_units?

A1:  set_units sets the units to a specific amount. Increment units increases the old total by a said amount :)


Q: can you go back to the def take_cs106a?

A1:  Yes, what’s your question?


Q: Do we use dicts or vars in milestone 1?

A1:  Variables


Q: The Homework has a placeholder about being teacher, can you talk more about it if applies for summer students :) thanks!

A1:  Unfortanately, you have to take 106B to section lead. Juliette would love to talk about other teaching opportunities


Q: why does it take in the parameter s when our name was juliette?

A1:  live answered


Q: If we turn in the extension today how much EC will it be worth? :)

A1:  The on time bonus is 2%. Extending your code is worth varying amounts of EC based on how much you extended


Q: is milestone 8 the last required portion of A6?

A1:  Yes, all milestones are required