Loading…
40 cards
Keep studying on Mneva
You’ve explored three public decks. Create a free account to keep studying unlimited cards and save your progress.
Free forever. No credit card needed.
Python
A high-level, interpreted programming language known for its readability and simplicity.
PEP 8
Python Enhancement Proposal that provides guidelines and best practices on how to write Python code.
What is a Python list?
An ordered, mutable collection of items that can be of mixed data types, defined using square brackets: [1, 'a', True].
Tuple
An immutable ordered collection of items, defined using parentheses: (1, 'a', True).
Dictionary
An unordered collection of key-value pairs, defined using curly braces: {'key': 'value'}.
Function
A block of reusable code that performs a specific task, defined using def keyword.
What is a Python module?
A file containing Python definitions and statements, intended to be imported and used in other Python programs.
Import statement
Used to include the functionality of a module into a Python program, using the import keyword.
What does len() do in Python?
Returns the number of items in an object like a list, tuple, or string.
Slice
A way to retrieve a portion of a sequence by specifying a start and end index: sequence[start:end].
How does `if name == 'main':` work?
Determines if the Python file is being run as the main program. If true, it runs the code block under it.
Lambda function
An anonymous, inline function defined with the lambda keyword, consisting of a single expression.
What is list comprehension?
A concise way to create lists using a single line of code with a for loop inside brackets: [x for x in range(5)].
Exception
An error that occurs during the execution of a program, disrupting normal flow.
Try-Except block
Used to handle exceptions in Python, allowing the program to continue execution.
What is a class in Python?
A blueprint for creating objects, encapsulating data and behavior.
Instance
An individual object created from a class.
Inheritance
A mechanism to create a new class using the properties and methods of an existing class.
What is a Python decorator?
A function that modifies the behavior of another function or method, often denoted with @decorator_name.
Global variable
A variable defined outside of a function, accessible throughout the program.
Local variable
A variable defined within a function, accessible only within that function.
What does return do in a function?
Sends a function's result back to the caller and exits the function.
Docstring
A string literal used to document a specific segment of code, written as the first statement in a function, module, or class.
What is self in a class method?
A reference to the current instance of the class, used to access instance variables and methods.
How do you comment a line in Python?
By using the # symbol at the beginning of the line.
Boolean
A data type that can be either True or False.
What is the `init` method?
A special method in Python classes used to initialize new instances, akin to a constructor.
For loop
A control flow statement used to iterate over a sequence, like a list or string.
While loop
A control flow statement that repeats a block of code as long as a condition is true.
Break statement
Terminates the nearest enclosing loop, allowing the program to proceed with the next statement outside the loop.
Continue statement
Skips the remaining code inside a loop for the current iteration and moves to the next iteration.
What is a set in Python?
An unordered collection of unique items, defined using curly braces: {1, 2, 3}.
What is Python's range() function?
Generates a sequence of numbers, often used in for loops.
File I/O
The process of reading from and writing to files using functions like open(), read(), and write().
How does string formatting work with f-strings?
A way to embed expressions inside string literals, using {} brackets and prefixing the string with f.
What is a generator?
A function that returns an iterator and is defined using yield instead of return.
Mutable vs Immutable
Mutable objects can be changed after creation (e.g., lists), while immutable objects cannot (e.g., tuples).
What is the GIL in Python?
Global Interpreter Lock, a mutex that protects access to Python objects, preventing multiple native threads from executing Python bytecodes at once.
What is pip?
A package manager for Python that allows you to install and manage additional libraries and dependencies.
What is the difference between == and is?
== checks for value equality, while is checks for reference (identity) equality.
Free forever. No credit card needed.
Ready to study Python 3 — Fundamentals?
Free forever. No credit card needed.