Docs
Python
Top 50

What is Python?

Python is a high-level, interpreted programming language that emphasizes code readability and simplicity.


What is an interpreter?

An interpreter is a program that executes code written in a programming language without the need for compiling it first.


What is a variable?

A variable is a container that stores a value, such as a number or string, which can be used throughout a program.


What is a function?

A function is a block of code that performs a specific task and can be reused throughout a program.


What is a module?

A module is a file containing Python definitions and statements that can be imported and used in other Python code.


What is a loop?

A loop is a control structure that allows a program to repeatedly execute a block of code until a condition is met.


What is a conditional statement?

A conditional statement is a control structure that allows a program to execute different code depending on whether a specified condition is true or false.


What is a list?

A list is a collection of values that can be of different types, such as numbers, strings, or other lists, and can be modified throughout a program.


What is a dictionary?

A dictionary is a collection of key-value pairs that can be used to store and retrieve data throughout a program.


What is an exception?

An exception is an error that occurs during program execution that can be caught and handled in a specified way to prevent the program from crashing.


What is a string?

A string is a sequence of characters, such as letters, numbers, and symbols, that can be used to represent text in Python.


What is a tuple?

A tuple is a collection of values that can be of different types, like a list, but once created, its values cannot be modified.


What is an argument?

An argument is a value passed to a function when it is called, which can be used by the function to perform its task.


What is a keyword?

A keyword is a reserved word in Python that has a specific meaning and cannot be used as a variable name or other identifier.


What is a class?

A class is a blueprint for creating objects that defines its attributes and methods.


What is an object?

An object is an instance of a class, which has its own unique identity, attributes, and methods.


What is inheritance?

Inheritance is a way of creating a new class by deriving it from an existing class, which allows the new class to inherit the attributes and methods of the existing class.


What is a module/package?

A module is a single file containing Python code, while a package is a directory containing one or more modules.


What is pip?

Pip is a package manager for Python that allows you to easily install, manage, and uninstall Python packages and their dependencies.


What is a virtual environment?

A virtual environment is a self-contained directory that contains a specific version of Python and its dependencies, allowing you to work on different projects with different dependencies without conflicts.


What is a loop variable?

A loop variable is a variable used in a loop that is assigned a new value each time the loop iterates.


What is a boolean?

A boolean is a data type that represents one of two values: True or False.


What is a method?

A method is a function that is associated with an object and can be called to perform an action on that object.


What is a lambda function?

A lambda function is a small, anonymous function that can take any number of arguments and return a single value.


What is slicing?

Slicing is a way of extracting a portion of a sequence, such as a string or a list, by specifying a start and end index.


What is a generator?

A generator is a special type of function that can be used to produce a sequence of values lazily, one at a time, instead of all at once.


What is a decorator?

A decorator is a special type of function that can be used to modify the behavior of another function without changing its source code.


What is a try-except block?

A try-except block is a way of handling exceptions in Python code by attempting to execute a block of code and catching any exceptions that may occur.


What is a set?

A set is an unordered collection of unique elements that can be used to perform set operations, such as union, intersection, and difference.


What is a file object?

A file object is a Python object that represents a file on disk, which can be opened and manipulated using various file methods.


What is a context manager?

A context manager is an object that defines methods that enable it to be used with the "with" statement to manage resources, such as opening and closing files.


What is a named tuple?

A named tuple is a subclass of the tuple class that allows you to assign names to each element in the tuple, making it easier to access them by name.


What is the difference between "==" and "is"?

The "==" operator compares the values of two objects, while the "is" operator compares their identities, or memory addresses.


What is a docstring?

A docstring is a string literal that appears as the first statement in a Python function, module, or class definition, which provides documentation about its purpose, inputs, and outputs.


What is a global variable?

A global variable is a variable defined outside of a function that can be accessed and modified by any part of the program.


What is a local variable?

A local variable is a variable defined within a function that can only be accessed and modified within that function.


What is recursion?

Recursion is a programming technique where a function calls itself to solve a problem, typically with a base case that terminates the recursion.


What is a list comprehension?

A list comprehension is a concise way of creating a new list by applying a transformation to each element of an existing list that meets a specified condition.


What is a dictionary comprehension?

A dictionary comprehension is a concise way of creating a new dictionary by applying a transformation to each key-value pair of an existing dictionary that meets a specified condition.


What is an iterator?

An iterator is an object that can be used to traverse a sequence of values, such as a list or a file, one at a time.


What is a generator expression?

A generator expression is a concise way of creating a generator using a similar syntax as list comprehensions, but without creating the whole list in memory.


What is a module namespace?

A module namespace is a collection of names defined in a module that can be accessed using the "dot" notation, such as "module_name.function_name()".


What is a package namespace?

A package namespace is a collection of names defined in a package that can be accessed using the "dot" notation, such as "package_name.module_name.function_name()".


What is a built-in function?

A built-in function is a function that is included in the Python language by default and can be used without importing any additional modules.


What is a standard library module?

A standard library module is a module that is included in the Python distribution and provides a set of pre-built functions and classes for performing common tasks.


What is the "if name == 'main'" statement?

The "if name == 'main'" statement is used to define the code that should be executed when a module is run as the main program, rather than imported as a module.


What is a context-free grammar?

A context-free grammar is a set of rules for generating strings in a language, typically used in the parsing of programming languages.


What is a stack?

A stack is a data structure that follows the last-in-first-out (LIFO) principle, where elements are added and removed from the top of the stack.


What is a queue?

A queue is a data structure that follows the first-in-first-out (FIFO) principle, where elements are added to the back of the queue and removed from the front.


What is a deque?

A deque (pronounced "deck") is a data structure that supports adding and removing elements from both ends of the sequence, allowing for efficient operations on both ends.