What kind of errors does exception handling prevent when implemented correctly?
Runtime
What does this line of code do? print(fr.readline());
readline() will read one line from the file
Where is professor Lu from
China
How do you spell aray
A R R A Y
What is a “template” or “blueprint” of an object called in Python?
Class
What modules do you have to import to check if a file exists or not?
Os, Sys
What is “reader”? (slide 4)
An object
What is the output for this code block? (slide 7)
a + b is [1, 2, 3, 4, 5, 6, 7, 8];
What method do you use to add an element to a list
.append()
What is a function tied to an object called in Python?
Method
What are the two built in keywords for exception handling in Python?
Try, Except
What does line 44 do? (slide 5)
read the column header
What is the output on line 200? (slide 8)
[1, 3, 4, 5]
How do you reference an element located at 3rd column, 4th row, of the array “student”?
student[3][2]
How do you declare the constructor method in Python?
def __init__():
What is the output? (Slide 3)
The system is experiencing technical difficulties. Please contact your system administrator or try again later. Bye! ============End of program
What does newline='' do?
Prevents extra blank rows and correctly handles newlines with quotes
Explain the difference between an array and a list and when to use each
Let the class be the judge
What is the output on line 201? (slide 9)
now length of a is 4
What parameter must every instance method in Python have?
self
Is it possible to catch multiple different kinds of exceptions and handle them in seperate ways?
Yes ( it is possible to handle multiple exceptions using one try: and multiple except: as long as you specify)
What is line 46 - 47 doing? (slide 6)
Iterates over the reader object and adds each row to the end of the distance list.
What color is the grass?
green
Explain pass by value and pass by array (When do you use each case)
Let the class be the judge
Explain how object oriented programming works in terms of your favorite video game
Let the class be the judge