August 4th, 2021
Q: I assume the quiz 2 would not include stuff already tested in quiz 1?
A1: No bit and images will not be on quiz 2. Strings are fair game for quiz 2
Q: Will classes be on quiz 2?
A1: Nope! Only the content through lec 23
Q: how does python files interact with frontend code?
A1: Like HTML? I’m not sure but will ask Juliette at the end :)
Q: is pycharm written in code?
A1: Yes! But I’m not sure which language
Q: for the read_file func on assignment 6, do we set the word_data dict to {}?
A1: Yes! You want to start word_data off as an empty dict
Q: will writing main functions be on the quiz? I don’t see it on the review but I know we have worked on it a lot.
A1: I don’t think so but will confirm will Juliette at the end :)
A2: Just to update, main is fair game for the quiz
Q: Why are we only being tested on lectures 8-23? It seems like this topic of python objects is valuable and important.
A1: We hope that you learn material whether you are tested or not. But classes is a bonus topic, we don’t always cover classes in 106A :) The next class in the series 106B goes much more in depth into classes so it doesn’t have to be covered in 106A. The core 106A material is the fundametals
Q: how do you get the reference when given an id?
A1: I don’t know if it can be done in Python
Q: So if you do x=6 and y=6, will the reference count say 2?
A1: If you did it with a mutable type (like lists or dict) yes. But not with ints
Q: for integer, can you make two integer point to the same id. For example, in c++ if you want a and b to have the same address, you can do: int& a = b;
A1: No, not in Python
Q: How could we use the id? meaning how would knowing what a variable’s id is be valuable information?
A1: In normal programming, you don’t need to know this. But this example is to show you what’s happening under the hood.
Q: Rs there a reason why y and z have the same ID?
A1: Yes, because they are pointing to the same value/slot in memory :)
Q: If you did x = 9 and y = 9 would they both point to the same spot in memory?
A1: Great question! For ints, no but for lists/dicts yes
Q: Does CS107 teach Java?
A1: No, it teaches C
Q: I'm having a problem in read_file() in assignment 6 where the word_data output (the key/word) returns word with a "\n" next to it. What does this mean and how do I get rid of it?
A1: Great question! ‘\n’ is the newline character. It’s the character that your computer uses to indicate a return/enter (i.e. new line). To remove that from the end of a line, you can use line.strip().
Q: Are there any functions in python that work with id? Like in C the scanf takes in the id instead of just the variable name when reading inputs. Like this: scanf(“%d”, &a);
A1: I don’t think so. Python is much more high level than C/C++ so you don’t really work with the addresses.
Q: Which lectures will be covered on the test?
A1: Lecs 8 -23 excluding software design
Q: How long will we have to complete the test?
A1: In the announcement posted on the class website yesterday, Juliette said the test will be apporximately 60mins but it may be shorter
Q: Is juliette chillin’ tho?
A1: Always :)
Q: how do you use the .strip() function?
A1: Let’s say you’ve opened a file and are iterating through the lines like this: with open(filename) as f: for line in f: line = line.strip() If you did these commands, line will store the line in the file without the new line character More Info here: https://cs.stanford.edu/people/nick/py/python-file.html
Q: If websites and computers are written in different languages, how do they interact?
A1: Such a great question! Will ask Juliette at the end :)
Q: If my phone was closer to Oregon (the facebook server) would the speed that facebooks loads on my phone change significantly?
A1: I believe no because it is so fast
Q: Will we need to know tkinter drawing commands for Quiz 2, or just the DrawCanvas commands?
A1: Great question! I believe just the DrawCanvas commands but will confirm with Juliette!
Q: Are ethics on the quiz?
A1: No, just on your homework
Q: Are the internet slides that Juliette is going through right now on the class website?
A1: Not yet but they will get posted after lecture :)
Q: Are the slides that the guest speaker went over on the quiz? :)
A1: Ethics will not be on the quiz :)
Q: This is mind-blowing, wow! It’s so cool how everything on the internet interacts so fast and with so many “clients”
A1: I love this lecture :)
Q: For how data find the shortest path. Is an algorithm like dijkstra ran everytime a data need to be sent, or is there a data structure that aways tracks the shortest path between every node and constantly updated, so everytime it need to calculate the shortest path it just obtains it?
A1: I will look into this :)
Q: What about main() do we need to know? :)
A1: Customizing main based on command line arguments and the calculator section problems are good practice :)
Q: i might be 10’ late to the exam, still geting the chance of doing in 60 mins? thanks :)
A1: There’s a 15min grace period to start but if you need more time accomodations reach out to Tara :)
Q: do we code a main function in the quiz?
A1: Perhaps
Q: will this quiz be on the same app as the last?
A1: Yes it will also be on BlueBook