exam 2 voacb ch 7 - 11 Flashcards
A variable used to count something. It’s usually initialized to zero and then incremented
Counter¶
A string with no characters and length 0, represented by two quotation marks.
Empty String
An operator, %, that takes a format string and a tuple and generates a string that includes the elements of the tuple formatted as specified by the format string.
Format Operator
A sequence of characters in a format string, like %d, that specifies how a value should be formatted.
Format Sequence
A string, used with the format operator, that contains format sequences
Format String
A boolean variable used to indicate whether a condition is true or false.
Flag
A statement that calls a method.
Invocation
A property of sequences whose items cannot be reassigned.
Immutable
An integer value used to select a character in a string
String Index
One of the values in a sequence
Item
A function that is associated with an object and called using dot notation
Method
A string that a variable can refer to. For now, you can use “object” and “value” interchangeably.
String Object
A pattern of traversal that stops when it finds what it is looking for.
Search
An ordered set; that is, a set of values where each value is identified by an integer index
Sequence
A part of a string specified by a range of indicies
Slice
To iterate through the items in a sequence, performing a similar operation on each
Transverse
Opens the file named filename for reading and returns a file object
file_obj = open(filename)
Closes an open file (most crucial when writing to a file)
file_obj.close()
Reads all data from a file object and returns it as a string
file_obj.read()
Returns a line from a file object as a string
file_obj.readline()
Returns a list of lines from a file object
file_obj.readlines()
Writes the line to the file object
file_obj.write(line)
Change directory - takes you to the root directory
cd
Will change the current directory to the specified directory
cd dir