Classes
Sets/Dictionaries
Reading/Writing Files
Libraries
Everything
200

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__

200

This built-in type represents an unordered collection of unique elements, created with curly braces like {1, 2, 3}.

what is a set

200

This built-in function opens a file and returns a file object, as in f = ______("data.txt", "r").

what is open

200

This library, usually imported as np, provides fast array operations and is the foundation for much of the scientific Python ecosystem.

what is numpy

200

In Python, you use this keyword to define a new class, as in ______ MyClass:.

what is "class"

400

Inside a class method, this conventional first parameter refers to the instance on which the method is called.

what is self

400

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

400

This file method reads the entire contents of a file into a single string, often used as data = f._______()

what is "read"
400

In pandas, this 2D labeled data structure, with rows and columns, is commonly created with pd.________(data).

what is "DataFrame"

400

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"

600

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

600

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])

600

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"

600

This method np.____([list]) takes a list as its input and constructs a new (more computationally efficient) data structure from it.

what is "array"

600

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"

800

In class Dog(Mammal):, Dog is the subclass and Mammal is this.

what is the parent class (base class works too)

800

This method removes and returns an arbitrary element from a set, and raises a KeyError if the set is empty.

what is .pop()

800

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"

800

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"

800

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"

1000

This special method is called when you use the len() function on an instance of your class.

what is __len__

1000

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()

1000

When you call f.write("hi") on a file, this is what the method returns.

what is "the number of characters written"

1000

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"

1000

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

M
e
n
u