This special method (dunder method) is automatically called when you create a new instance of a class and is often used to set up instance attributes.
what is __init__
This built-in type represents an unordered collection of unique elements, created with curly braces like {1, 2, 3}.
what is a set
This built-in function opens a file and returns a file object, as in f = ______("data.txt", "r").
what is open
This library, usually imported as np, provides fast array operations and is the foundation for much of the scientific Python ecosystem.
what is numpy
In Python, you use this keyword to define a new class, as in ______ MyClass:.
what is "class"
Inside a class method, this conventional first parameter refers to the instance on which the method is called.
what is self
In a Python dictionary like d = {"a": 1, "b": 2}, the "a" and "b" parts must be unique and are called this.
what are keys
This file method reads the entire contents of a file into a single string, often used as data = f._______()
In pandas, this 2D labeled data structure, with rows and columns, is commonly created with pd.________(data).
what is "DataFrame"
For a set s, this method removes an element and raises a KeyError if it’s not present, while its cousin discard silently does nothing if the element is missing
what is "remove"
This feature of Python classes lets you create a new class that reuses and extends behavior from an existing class, often written as class Child(Parent).
what is inheritance
Because sets are unordered and only store unique items, this common sequence operation is not allowed and will raise a TypeError.
what is indexing (ex. my_set[3])
This file method, often used in a loop like line = f.________(), reads one line at a time from a text file, including the trailing newline.
what is "readline"
This method np.____([list]) takes a list as its input and constructs a new (more computationally efficient) data structure from it.
what is "array"
In NumPy, this method changes the shape of an array without changing its data, as in arr.________(2, 3) to view it as a 2×3 array
what is "reshape"
In class Dog(Mammal):, Dog is the subclass and Mammal is this.
what is the parent class (base class works too)
This method removes and returns an arbitrary element from a set, and raises a KeyError if the set is empty.
what is .pop()
This keyword is used in conjunction with 'open("file.txt") as f:' so that the file is automatically closed when the block finishes.
what is "with"
In pandas, this method is commonly used to load tabular data from a CSV file into a DataFrame, as in pd.________("data.csv").
what is "read_csv"
In open("notes.txt", "blank"), this mode character (blank) controls how the file is opened and means “create a new file explicitly”
what is "x"
This special method is called when you use the len() function on an instance of your class.
what is __len__
This method returns a view object of key/value pairs, often used in a for loop as for k, v in d.______():
what is .items()
When you call f.write("hi") on a file, this is what the method returns.
what is "the number of characters written"
In NumPy functions like np.sum(arr, ___=0) or np.mean(arr, ___=1), this parameter name controls which dimension is reduced over.
what is "axis"
my_dict = {"age": 20}
executing the line: len(my_dict["age"])
produces this kind of error. The error description would be "object of type 'int' has no len()"
TypeError