Final 5 Flashcards
(15 cards)
What is a Try statement?
A statement where you put code that might crash so that it will be encapsulated in an “try block” to output a custom error if it doesn’t work as intended
Trivia: Try statement song reference to just being reckless with code
“Jump” - Van Halen
Do dictionaries exist as a data type in Python?
Yes.
Trivia: TV show reference for objects and connections
Avatar: The Last Airbender (“All Connected”
Functions attached to objects are usually called:
Methods
Trivia: In reference to door objects, what TV show was used?
Get Smart (Revolving Door Scene)
What is inheritance?
When a variable of a certain object type inherits all the variables, functions/methods associated with it.
What is polymorphism?
Conversion of methods to suit an appropriate output for the input.
How do you initialize a variable of a given type or class?
With a constructor (or initializer method)
What is an instance variable?
A variable of a particular class, i.e. “Daniel” is an instance variable of class “human”, just one particular object under that umbrella
What is a class?
A particular “type” of object/variable you define, such as “human”
What is a class variable?
A variable which pertains to a whole class of objects rather than a particular instance variable. “The number of human objects declared so far” refers to the whole class and not particular instances.
What is an instance value?
A value which pertains to a particular object of a class, such as Daniel.height (height attribute of instance variable Daniel)
What is Function __init__() ?
Interpreter assumes that if a function has this name formatting, it is to be used as the means of of initializing an object of this class