Words Flashcards
Object
1) The most basic type of thing
2) Any instance of some thing
Instance
What you get when you tell Python to create a class
def
define a function
self
A variable inside the functions in a class for the instance/object being accessed
(For self-reference)
Inheritance
The concept that one class can inherit traits from another class
Composition
The concept hat one class can be composed of other classes as parts
attribute
A property classes have that are from composition. Usually variables
is-a
Inherits traits from
has-a
Is composed of
Class
Tell Python to create a new type of thing
#
Octothorpe. Used for comments that are not part of the code
print “X”
Displays whatever text is in quotes
String
Normal text inside quotes “ or ‘
%s
Format character. Use to insert variable
%r
Format character. Used to insert variable EXACTLY (raw)
round()
Rounds number in () to nearest whole
True and false
Used to tell code what is true or false. Also returned if the code is asked whether something is true or false
%
Formatter. Used to reference variables to insert
\n
New line character. Starts a new line within a string
\
Backslash. Escape character. Used within strings before character that might be mistaken by Python as code
raw_input()
Asks operator for input
from X import Y
Tells Python to import Y from library X
argv
Argument variable. Function in sys that holds the arguments passed through script
open
Opens a file
pydoc X
Displays manual page for command X
read
shows file. Result can be assigned to a variable