0% found this document useful (0 votes)
1 views19 pages

Python Programming Study Guide

This Python Programming Study Guide covers core concepts such as syntax, data types, control flow, and data structures, providing a comprehensive foundation for programming in Python. It also delves into advanced topics including functions, modules, object-oriented programming, file I/O, exception handling, and data science methodologies. The guide emphasizes Python's versatility, beginner-friendliness, and the importance of using Python 3 for modern development.

Uploaded by

malbzs9876
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views19 pages

Python Programming Study Guide

This Python Programming Study Guide covers core concepts such as syntax, data types, control flow, and data structures, providing a comprehensive foundation for programming in Python. It also delves into advanced topics including functions, modules, object-oriented programming, file I/O, exception handling, and data science methodologies. The guide emphasizes Python's versatility, beginner-friendliness, and the importance of using Python 3 for modern development.

Uploaded by

malbzs9876
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Python Programming Study Guide

I. Core Concepts

This section covers the foundational elements of Python programming, from its basic syntax
to fundamental data structures and control flow.

A. Introduction to Python

 What is Python?Python is a general-purpose, high-level programming language used


for web and software development, task automation, and data analysis.

 It is known for its versatility and beginner-friendliness, making it popular across


various fields.

 The name "Python" was inspired by Monty Python's Flying Circus.

 Why Python?Versatility: Applicable to diverse tasks (web development, machine


learning, data science, general scripting).

 Beginner-friendly: Easy to learn due to its pseudocode-like nature, making code


readable like English.

 Open Source & Free: Free to use and distribute, even for commercial purposes.

 Vast Libraries & Modules: Extensive and growing archive of third-party code bundles
(e.g., Pygame, Matplotlib, Plotly, Django, NumPy, Pandas, TensorFlow, Keras).

 Large and Active Community: Provides ample support and resources for problem-
solving.

 Python Versions:Python 3 is the current, more up-to-date, and popular version.

 Python 2 was sunsetted in January 2020 and no longer receives updates.

 It is crucial to use Python 3 for modern development.

 Running Python Code:Python Interpreter/Shell (REPL): "Read-Eval-Print Loop"


allows interactive execution of code snippets directly in the terminal (e.g., >>>
print("Hello Python interpreter!")).

 Text Editors (e.g., VS Code, Sublime Text): Recommended for writing and running
larger programs (.py files).

 Online Environments: Google Colaboratory and Kaggle Kernels provide cloud-based


Jupyter Notebook environments for Python.

B. Variables and Data Types

 Variables:Act as labels or names given to memory locations that store values


(information).
 Naming Rules:Can contain letters, numbers, and underscores.

 Must start with a letter or an underscore, not a number (e.g., message_1 is valid,
1_message is not).

 Cannot contain spaces (use underscores for multiple words: greeting_message).

 Avoid Python keywords and built-in function names.

 Should be short but descriptive (e.g., student_name over s_n).

 Conventionally lowercase for variables; uppercase for constants.

 Assignment Operator (=): Used to assign a value to a variable (e.g., message = "Hello
Python world!").

 Multiple Assignment: Assign values to multiple variables in a single line (e.g., x, y, z =


0, 0, 0).

 Constants: Indicated by all capital letters in variable names (e.g., PI = 3.14159),


signifying their values should not change.

 Data Types:Integers (int): Whole numbers (e.g., 5, 100).

 Floating-point numbers (float): Numbers with decimal points (e.g., 3.14, 98.5).

 Note: Operations involving floats often result in floats, even if the result is a whole
number (e.g., 4/2 results in 2.0).

 Can sometimes result in arbitrary decimal places due to internal representation


(round-off errors).

 Overflow errors occur when values are too large to be stored.

 Strings (str): Sequences of characters, enclosed in single (') or double (") quotes (e.g.,
'hello', "World").

 Immutability: Strings cannot be changed after they are created; any modification
results in a new string.

 String Operations: Concatenation (+), repetition (*).

 String Methods: title(), upper(), lower(), strip(), lstrip(), rstrip(), count(), find(),
index(), split(), join().

 Formatted Strings (f-strings): Introduced in Python 3.6, allow embedding expressions


inside string literals for easy formatting (e.g., f"My {animal} says {says}").

 String Slicing: Accessing substrings using [start:end:step] notation. Indexing starts at


0, negative indices count from the end.

 Booleans (bool): Represent truth values, either True or False.


 NoneType (None): Represents the absence of a value.

C. Operators

1. Arithmetic Operators: +, -, *, / (true division), // (floor division), % (modulo), **


(exponentiation).

2. Assignment Operators: =, +=, -=, etc.

3. Comparison Operators: == (equal to), != (not equal to), > (greater than), < (less
than), >= (greater than or equal to), <= (less than or equal to).

 = for assignment, == for comparison.

1. Logical Operators: and, or, not. Used to combine or negate Boolean expressions.

2. Operator Precedence: Rules determining the order in which operations are


evaluated. Parentheses can be used to enforce a specific order.

D. Control Flow

 Conditional Statements (if, elif, else):Execute blocks of code based on whether a


condition evaluates to True or False.

 if statement: Executes code if its condition is true.

 if-else statement: Executes one block if true, another if false.

 if-elif-else chain: Allows checking multiple conditions sequentially.

 Nested decisions: if statements inside other if or else blocks.

 Conditional Expressions: Compact one-line if-else (e.g., expression_if_true if


condition else expression_if_false).

 Loops (while, for):Execute blocks of code repeatedly.

 while loop: Continues as long as its condition remains true. Requires a mechanism to
make the condition eventually false to avoid infinite loops.

 for loop: Iterates over a sequence (e.g., list, tuple, string) or a range of numbers.

 range() function: Generates a sequence of numbers (e.g., range(start, stop, step)).

 Nested loops: One or more loops inside another loop.

 Loop Control Statements:break: Exits the loop entirely.

 continue: Skips the current iteration and moves to the next.

 loop else: An optional else block associated with for or while loops, which executes
only if the loop completes without encountering a break statement.
E. Data Structures (Containers)

 Lists:Ordered, mutable collections of items, enclosed in square brackets [] (e.g.,


['apple', 'banana', 'cherry']).

 Can store any data type, including other lists (nested lists).

 Indexing: Access elements by their position (starting at 0), supports negative


indexing.

 Slicing: Get a subset of the list using [start:end:step].

 Methods: append() (add to end), insert() (add at specific index), remove() (remove
first occurrence of value), pop() (remove by index, or last), sort() (in-place sort),
reverse() (in-place reverse).

 Common Operations: len(), min(), max(), sum().

 List Comprehensions: Compact way to create new lists based on existing iterables
using a single line (e.g., [expression for item in iterable if condition]).

 Tuples:Ordered, immutable collections of items, enclosed in parentheses () (e.g., (1,


2, 3)).

 Once defined, their elements cannot be changed.

 Accessed and sliced similarly to lists.

 Useful for data that should not change throughout the program.

 Methods: count(), index().

 Dictionaries:Unordered, mutable collections of key-value pairs, enclosed in curly


braces {} (e.g., {'name': 'Alice', 'age': 30}).

 Each key must be unique and immutable (e.g., strings, numbers, tuples). Values can
be of any type.

 Accessing Values: Using square bracket notation (my_dict['key']) or the get() method
(my_dict.get('key', default_value)).

 Adding/Updating: my_dict['new_key'] = new_value.

 Removing: del my_dict['key'] or pop().

 Methods: keys() (returns view of keys), values() (returns view of values), items()
(returns view of key-value pairs).

 Can be nested (dictionaries within dictionaries, lists within dictionaries, etc.).

 Dictionary Comprehensions: Similar to list comprehensions for creating dictionaries.


 Sets:Unordered collections of unique, immutable elements, enclosed in curly braces
{} (e.g., {1, 2, 3}).

 Duplicate elements are automatically removed.

 Useful for membership testing and mathematical set operations (union, intersection,
difference).

F. Functions and Modules

 Functions:Named, reusable blocks of code that perform a specific task.

 Defined using def keyword.

 Docstrings: Optional string literals used to document a function's purpose (enclosed


in triple quotes).

 Parameters: Variables listed inside the parentheses in the function definition, acting
as placeholders for input.

 Arguments: Actual values passed to a function when it is called.

 Positional Arguments: Matched by order.

 Keyword Arguments: Passed by name, allowing for flexible order.

 Default Parameter Values: Allow parameters to be optional.

 Arbitrary Arguments (*args, **kwargs): Allow functions to accept an arbitrary


number of positional or keyword arguments.

 Return Values: Functions can return a value using the return statement. If no return
is specified, None is returned implicitly.

 Scope:Local Scope: Variables defined inside a function are local to that function and
cease to exist after the function finishes.

 Global Scope: Variables defined outside any function are global and can be accessed
(but not directly modified without global keyword) from anywhere in the program.

 Modules:Files ending in .py that contain Python code (functions, classes, variables)
that can be imported and reused in other programs.

 Importing:import module_name: Imports the entire module.

 from module_name import specific_item: Imports specific items from a module.

 import module_name as alias: Imports a module with an alias.

 Name Collisions: Occur when functions from different modules have the same name;
can be avoided using aliases or specific imports.
 Top-level Code (if __name__ == "__main__":): A common idiom to ensure certain
code only runs when the script is executed directly, not when imported as a module
(prevents side effects).

 Standard Library: Collection of built-in modules (e.g., math, random, datetime, os,
sys, statistics, json).

 Third-party Modules (PyPI): Python Package Index (PyPI) is a repository for third-
party libraries (e.g., pip is used to install them, such as requests, numpy, pandas,
matplotlib, plotly, pygame, Django).

 Module Documentation (help()): Built-in function to view documentation for


modules and functions.

G. Object-Oriented Programming (OOP)

 Core Concepts:Classes: Blueprints or templates for creating objects. Define attributes


(data/fields) and methods (functions/procedures).

 Objects (Instances): Real-world entities modeled in a program, created from a class.


Each object is an instance of a class and has its own set of attributes.

 Encapsulation: Bundling data (attributes) and methods that operate on that data into
a single unit (class), restricting direct access to the data.

 Abstraction: Showing only essential information and hiding complex implementation


details.

 Class and Instance Attributes:Class Attributes: Shared by all instances of a class (e.g.,
imprint for a Book class).

 Instance Attributes: Unique to each instance of a class (e.g., title, author for a Book
object).

 Methods:Functions defined within a class.

 __init__() (Constructor): A special "magic" method called automatically when a new


instance of a class is created. Used to initialize instance attributes. self is the first
parameter and refers to the current instance.

 Instance Methods: Operate on instance attributes and require self as their first
parameter.

 Static Methods: Do not operate on instance or class attributes, typically utility


functions related to the class.

 Class Methods: Operate on class attributes.


 Operator Overloading (Magic/Dunder Methods):Special methods (starting and
ending with double underscores, e.g., __add__, __str__) that allow built-in operators
to work with user-defined class instances.

 __add__() for + operator, __str__() for string representation.

 Inheritance:Allows a new class (subclass/derived class/child class) to inherit


attributes and methods from an existing class (superclass/base class/parent class).

 Promotes code reuse and creates hierarchical relationships between classes.

 super() function: Used in a subclass's __init__() method to call the __init__() method
of its superclass, ensuring inherited attributes are properly initialized.

 Method Overriding: Subclasses can provide their own implementation of a method


already defined in their superclass.

 Polymorphism: The concept of having many forms; a single name (e.g., a method
name) can map to multiple functionalities depending on the object's class type.

 Multiple Inheritance: A class can inherit from multiple parent classes.

 Mixin Classes: Classes designed to provide specific functionalities to other classes


through inheritance without being standalone classes themselves.

 Organizing Classes in Modules:Classes can be stored in separate .py files (modules)


and imported into a main program to keep projects organized.

H. File I/O and Exception Handling

 Files:Data stored persistently on a storage device (non-volatile memory).

 Python programs can read content from and write content to files.

 Volatile vs. Non-volatile Memory: RAM is volatile (temporary data); hard disks store
data non-volatily (persists).

 Opening Files (open() function):Syntax: open("filename", "mode").

 Modes:'r' (read): Default, file must exist.

 'w' (write): Creates file if not exists, overwrites if exists.

 'a' (append): Creates file if not exists, adds to end if exists.

 'r+' (read and write).

 Paths: Can specify full paths for files in different locations.

 Reading from Files:read(): Reads entire file content into a single string.

 readline(): Reads one line at a time.


 readlines(): Reads all lines into a list of strings.

 Writing to Files:write(string): Writes a string to the file. Other data types must be
cast to string.

 \n (newline character) needed for new lines.

 Closing Files (close()): Important to save changes and release file resources.

 with Statement (Context Manager): Preferred way to handle files; ensures the file is
automatically closed even if errors occur.

 CSV Files: Common format for tabular data; can be processed line by line.

 Exception Handling:Exceptions: Errors that occur during program execution (e.g.,


FileNotFoundError, ValueError, IndexError, ZeroDivisionError).

 try-except Block: Used to gracefully handle potential errors, preventing program


crashes.

 Code that might raise an exception goes in the try block.

 Code to execute if a specific exception occurs goes in the except block.

 else Block (with try): Executes if the code in the try block runs without any
exceptions.

 finally Block: Always executes, regardless of whether an exception occurred or was


handled. Useful for cleanup operations (e.g., closing files).

 Raising Exceptions (raise keyword): Explicitly raises an exception to indicate a critical


error or invalid state.

I. Data Science and Advanced Topics

1. Data Science Life Cycle: Multidisciplinary field involving:

 Data Acquisition: Obtaining or collecting data.

 Data Exploration: Cleaning, inspecting, and visualizing data.

 Data Analysis: Generating insights or building predictive models.

 Reporting: Sharing findings with stakeholders.

 Data Science Tools/Libraries:Jupyter Notebooks: Interactive computing environment


(e.g., Google Colaboratory, Kaggle Kernels).

 NumPy (numpy): Fundamental library for numerical operations, supporting efficient


multi-dimensional arrays (ndarray) for homogeneous data.
 Pandas (pandas): Library for data analysis, providing data structures like Series (1D
labeled array) and DataFrame (2D labeled table for heterogeneous data). Useful for
reading CSV/Excel files, data manipulation, and summary statistics (describe(), info(),
value_counts(), unique(), loc[], iloc[]).

 Matplotlib (matplotlib.pyplot): Library for creating static, animated, and interactive


visualizations (line plots, bar plots, scatter plots, histograms).

 Plotly: Library for creating interactive, web-based visualizations (scattergeo charts for
mapping, histograms for distributions, bar plots, line plots). Generates visualizations
that resize and include interactive features.

 TensorFlow & Keras: Libraries for machine learning and artificial intelligence.

 SciPy: Project for scientific computing.

 Scikit-learn: Tools for predictive data analysis.

 Recursion:A function that calls itself to solve a problem.

 Base Case: A condition that stops the recursion, preventing an infinite loop.

 Recursive Case: The step where the function calls itself with a modified input that
moves towards the base case.

 Examples: Factorial calculation, Fibonacci sequence, solving the "Three Towers"


problem, binary search (for sorted lists).

 Can be a more direct way to code certain algorithms but requires careful definition of
base cases.

 Advanced Python Features (from Python 3.8+):Walrus Operator (:=): Assignment


expressions, allows assigning values to variables as part of a larger expression.

 match-case Statement (Python 3.10+): Structural pattern matching, similar to switch


statements in other languages, for cleaner conditional logic.

 Virtual Environments (venv, virtualenv):Isolated Python environments that allow


different projects to use different versions of packages without conflicts.

 Good practice for managing project dependencies (pip freeze > requirements.txt, pip
install -r requirements.txt).

 Web Development Frameworks (e.g., Django, Flask):Django: High-level Python web


framework that encourages rapid development and clean, pragmatic design. Uses
models (classes) to interact with databases.

 Models: Classes that define how data is stored in the app (e.g., Topic, Entry).

 Migrations: Django's way of applying changes made to models to the database.


 Admin Site: Built-in interface for managing data.

 URLs: Define URL patterns that map to view functions.

 Views: Functions that handle web requests and return responses.

 Templates: HTML files that define the structure and content of web pages. Use
template tags ({% %}) and template inheritance ({% extends %}, {% block %}).

 Forms: Handle user input for web applications.

 User Authentication: Django provides built-in systems for user registration, login,
and access control (@login_required).

 Flask: A lightweight web framework for building web applications and APIs.

 APIs (Application Programming Interfaces):Allow programs to interact with external


services (e.g., GitHub, Hacker News, OpenAI, news APIs).

 requests library used for making HTTP requests (GET, POST).

 JSON format commonly used for API responses.

 Automating Tasks (pyautogui):Library for programmatically controlling the mouse


and keyboard, useful for automation.

 Speech Recognition and Text-to-Speech:Libraries like speech_recognition (for


converting audio to text) and pyttsx3 or gTTS (Google Text-to-Speech for converting
text to audio).

 Version Control (Git):System for tracking changes to code over time (e.g., git init, git
add, git commit, branches, .gitignore). Essential for collaborative development and
managing project history.

 Code Quality and Style:PEP 8: Official Python style guide, recommending guidelines
for indentation (4 spaces), line length (less than 80 characters), spacing around
operators, blank lines, and variable naming conventions.

 Comments (#) and Docstrings ("""Docstring"""): Crucial for explaining code purpose
and improving readability.

II. Quiz

Instructions: Answer each question in 2-3 sentences.

1. Explain the primary difference between a list and a tuple in Python.

2. What is the purpose of the if __name__ == "__main__": block in a Python script?

3. Describe the try-except block and why it is important in Python programming.


4. How do Python's // (floor division) and % (modulo) operators differ from the
standard / (true division) operator?

5. What is a "magic method" in Python, and provide one example of its use.

6. Explain why float(2) produces 2.0 and int(5.9) produces 5 in Python.

7. What is the role of the self parameter in Python class methods, particularly within
the __init__ method?

8. Briefly explain what an "API" is and how Python programs typically interact with
them.

9. What are f-strings, and what advantage do they offer over older string formatting
methods?

10. Describe the concept of "operator overloading" in the context of Python's object-
oriented programming.

III. Quiz Answer Key

1. Explain the primary difference between a list and a tuple in Python. Lists are
mutable, meaning their elements can be changed, added, or removed after creation,
and are defined with square brackets ([]). Tuples, on the other hand, are immutable,
meaning their contents cannot be altered once defined, and are typically defined
with parentheses (()). This immutability makes tuples suitable for fixed collections of
items, while lists are used for collections that require modification.

2. What is the purpose of the if __name__ == "__main__": block in a Python script?


This block allows code to be executed only when the script is run directly, not when
it's imported as a module into another script. When a Python file is run directly, its
__name__ variable is set to "__main__"; otherwise, it's set to the module's name.
This prevents "side effects" where import statements unintentionally run executable
code from the imported module.

3. Describe the try-except block and why it is important in Python programming. The
try-except block is used for exception handling, allowing a program to manage errors
that occur during execution without crashing. Code that might cause an error is
placed in the try block, and if an exception occurs, the corresponding except block is
executed to handle it gracefully. This ensures robustness and a better user
experience by preventing abrupt program termination.

4. How do Python's // (floor division) and % (modulo) operators differ from the
standard / (true division) operator? The / (true division) operator always performs
floating-point division, returning a float even if the result is a whole number (e.g., 7 /
4 is 1.75). The // (floor division) operator computes the quotient and rounds the
result down to the nearest whole number (integer) (e.g., 7 // 4 is 1). The % (modulo)
operator computes the remainder of a division (e.g., 7 % 4 is 3).

5. What is a "magic method" in Python, and provide one example of its use. Magic
methods, also known as dunder methods (due to their double underscores), are
special methods that allow you to define how objects of your class behave with built-
in operations or functions. An example is __init__(), which is the constructor called
automatically when a new instance of a class is created, used to initialize the object's
attributes.

6. Explain why float(2) produces 2.0 and int(5.9) produces 5 in Python. float(2)
produces 2.0 because the float() function converts its input into a floating-point
number, which always includes a decimal part. int(5.9) produces 5 because the int()
function converts its input into an integer, which means it truncates or removes any
fractional part, effectively rounding down towards zero.

7. What is the role of the self parameter in Python class methods, particularly within
the __init__ method? The self parameter is a convention in Python class methods
that refers to the instance of the class itself. When a method is called on an object
(e.g., my_object.method()), Python automatically passes the object (my_object) as
the first argument to the self parameter. In __init__, self is used to define and
initialize the unique attributes for that specific instance being created.

8. Briefly explain what an "API" is and how Python programs typically interact with
them. An API (Application Programming Interface) is a set of rules and protocols that
allows different software applications to communicate with each other. Python
programs typically interact with APIs by making HTTP requests (e.g., GET, POST) to a
server using libraries like requests. The API then sends back data, often in JSON
format, which the Python program parses and uses.

9. What are f-strings, and what advantage do they offer over older string formatting
methods? F-strings (formatted string literals), introduced in Python 3.6, are a way to
embed expressions inside string literals by prefixing the string with f or F. Their main
advantage is improved readability and conciseness, as they allow direct insertion of
variable names and expressions within curly braces {} inside the string, making them
much simpler and faster than older methods like str.format() or % formatting.

10. Describe the concept of "operator overloading" in the context of Python's object-
oriented programming. Operator overloading in Python allows programmers to
define custom behaviors for standard operators (like +, -, *, ==) when applied to
instances of user-defined classes. This is achieved by implementing specific "magic"
or "dunder" methods within the class (e.g., __add__ for +, __eq__ for ==). It
enhances the intuitiveness and readability of code by allowing objects to behave
with operators in a way that makes sense for their representation.
IV. Essay Format Questions

1. Compare and contrast the while loop and the for loop in Python. Discuss scenarios
where each loop type would be most appropriate, providing examples of their usage
in different programming contexts.

2. Explain the concept of mutability and immutability in Python, specifically in relation


to strings, lists, and tuples. Discuss the implications of these characteristics on how
data is handled and modified in Python programs.

3. Discuss the importance of Object-Oriented Programming (OOP) principles


(encapsulation, abstraction, inheritance, polymorphism) in designing and writing
large-scale Python applications. Provide an example for each principle to illustrate its
role.

4. Describe the Python data science ecosystem, detailing the roles of core libraries like
NumPy, Pandas, and Matplotlib/Plotly. Explain how these libraries collectively enable
data acquisition, analysis, and visualization.

5. Explain how Python supports modular programming through functions and modules.
Discuss the benefits of using functions and organizing code into modules, including
considerations for variable scope and avoiding side effects when importing.

V. Glossary of Key Terms

 __init__() (Constructor): A special method in Python classes that is automatically


called when a new instance of the class is created. It is used to initialize the object's
attributes.

 if __name__ == "__main__":: A common Python idiom that defines a block of code


to be executed only when the script is run directly, not when it is imported as a
module.

 Abstraction: An OOP principle that involves showing only essential information and
hiding complex implementation details from the user.

 API (Application Programming Interface): A set of rules and protocols that allows
different software applications to communicate and interact with each other.

 append(): A list method used to add a new element to the end of a list.

 Argument: The actual value passed to a function when it is called, corresponding to a


parameter in the function's definition.

 Assignment Operator (=): The operator used in Python to assign a value to a


variable.

 Attribute: A piece of data or characteristic associated with an object or a class in


object-oriented programming.
 Base Case: In recursion, the condition that stops the recursive calls, preventing an
infinite loop.

 Boolean Expression: An expression that evaluates to either True or False.

 break: A control flow statement used to immediately exit the current loop (either for
or while).

 Class: A blueprint or template for creating objects, defining their attributes and
methods.

 Class Attribute: An attribute whose value is shared by all instances of a class.

 Comparison Operator: Operators (e.g., ==, !=, >, <, >=, <=) used to compare two
values and return a Boolean result.

 Conditional Statement (if, elif, else): Control structures that execute different blocks
of code based on whether specified conditions are true or false.

 Constant: A variable whose value is intended to remain unchanged throughout the


life of a program; conventionally named with all capital letters in Python.

 Container: A Python object that can hold an arbitrary number of other objects, such
as lists, tuples, dictionaries, and sets.

 continue: A control flow statement that skips the rest of the current iteration of a
loop and proceeds to the next iteration.

 CSV (Comma-Separated Values): A plain-text file format for storing tabular data,
where each line is a data record and fields are separated by commas.

 Data Science: A multidisciplinary field that combines collecting, processing, and


analyzing large volumes of data to extract insights.

 Data Type: The classification of data that determines what kind of values a variable
can hold and what operations can be performed on it (e.g., int, float, str, bool).

 dict (Dictionary): A mutable, unordered collection of unique key-value pairs in


Python.

 Django: A high-level Python web framework that enables rapid development of


secure and maintainable websites.

 Docstring: A string literal used for documentation within Python modules, classes,
functions, or methods, typically enclosed in triple quotes.

 Dunder Method: Informal term for "magic method," referring to methods with
names starting and ending with double underscores (e.g., __add__).
 Encapsulation: An OOP principle that involves bundling data and the methods that
operate on that data into a single unit (a class), restricting direct external access.

 Exception: An event that interrupts the normal flow of a program during its
execution, indicating an error or an unusual condition.

 except Block: The part of a try-except statement that specifies code to be executed
when a particular type of exception occurs.

 f-string (Formatted String Literal): A string literal prefixed with 'f' or 'F' that allows
embedding Python expressions directly within curly braces {} inside the string.

 for loop: A control flow statement that iterates over a sequence (like a list, tuple, or
string) or other iterable objects.

 Function: A named, reusable block of code that performs a specific task.

 Global Scope: The context in a program where variables are accessible from
anywhere in the code, outside of any specific function.

 help(): A built-in Python function used to access documentation for modules,


functions, classes, and keywords.

 High-level Language: A programming language that provides a strong abstraction


from the details of the computer, making it easier for humans to read and write.

 HTTP Requests: The way web browsers and applications communicate with servers
over the internet (e.g., GET to retrieve data, POST to send data).

 Immutability: The characteristic of a data type whose value cannot be changed after
it is created (e.g., strings, tuples).

 Inheritance: An OOP principle where a new class (subclass) derives attributes and
methods from an existing class (superclass), promoting code reuse.

 Instance: A specific object created from a class; a concrete realization of the class
blueprint.

 Instance Attribute: An attribute whose value is unique to each individual instance of


a class.

 Integer (int): A whole number data type in Python, without a fractional component.

 Jupyter Notebook: An open-source web application that allows you to create and
share documents containing live code, equations, visualizations, and narrative text.

 Keyword: Words reserved by Python that have special functions and cannot be used
as variable names.
 len(): A built-in Python function that returns the length (number of items) of an
object, such as a string, list, or tuple.

 list: A mutable, ordered collection of items in Python, enclosed in square brackets [].

 List Comprehension: A concise syntax for creating new lists by applying an expression
to each item in an iterable, optionally with a conditional filter.

 Local Scope: The context within a function where variables defined inside that
function are accessible only from within that function.

 Logical Operator: Operators (and, or, not) used to combine or modify Boolean
expressions.

 Loop Else: An optional else block associated with for or while loops that executes
only if the loop completes without encountering a break statement.

 Magic Method: See Dunder Method.

 match-case: A control flow statement (introduced in Python 3.10) for structural


pattern matching, similar to switch statements in other languages.

 Matplotlib: A comprehensive Python library for creating static, animated, and


interactive visualizations in Python.

 Method: A function defined within a class that operates on the class's data
(attributes).

 Module: A .py file containing Python code (functions, classes, variables) that can be
imported and reused in other programs.

 Mutability: The characteristic of a data type whose value can be changed after it is
created (e.g., lists, dictionaries, sets).

 Nested Loop: A loop placed inside the body of another loop.

 None: A special constant in Python that represents the absence of a value or a null
value.

 NumPy (numpy): A fundamental Python library for numerical computing, providing


support for large, multi-dimensional arrays (ndarray) and mathematical functions.

 Object: A specific instance of a class, representing a real-world entity with its own
attributes and methods.

 Object-Oriented Programming (OOP): A programming paradigm based on the


concept of "objects," which can contain data and code to manipulate that data.

 open(): A built-in Python function used to open a file, returning a file object.
 Operator Overloading: The ability to define how standard operators (e.g., +, -, ==)
behave when applied to instances of user-defined classes.

 pandas: A powerful Python library for data manipulation and analysis, providing data
structures like DataFrame and Series.

 Parameter: A variable listed inside the parentheses in a function definition, serving


as a placeholder for the input argument.

 PEP 8: The official style guide for Python code, providing recommendations for
formatting and conventions to improve code readability.

 pip: The package installer for Python, used to install and manage third-party libraries
from PyPI.

 Plotly: A Python graphing library used to create interactive, publication-quality


graphs online.

 Polymorphism: An OOP principle allowing objects of different classes to be treated


as objects of a common type, enabling a single interface to represent different
underlying forms.

 pop(): A list method that removes and returns an element from a specified index (or
the last element if no index is given).

 Program: A set of instructions that a computer can execute to perform a specific


task.

 Prompt: A message displayed to the user indicating that the program is waiting for
input.

 Pseudocode: An informal high-level description of the operating principle of a


computer program or other algorithm.

 Pygame: A set of Python modules designed for writing video games.

 PyPI (Python Package Index): A repository of software for the Python programming
language, where users can find and install third-party modules.

 pyttsx3: A Python library for text-to-speech conversion, allowing programs to speak


text aloud.

 range(): A built-in Python function that generates a sequence of numbers, often used
with for loops.

 raise: A keyword used to explicitly trigger an exception in Python.

 read(): A file method that reads the entire content of a file into a single string.

 readline(): A file method that reads a single line from a file.


 readlines(): A file method that reads all lines from a file into a list of strings.

 Recursion: A programming technique where a function calls itself, directly or


indirectly, to solve a problem.

 REPL (Read-Eval-Print Loop): An interactive programming environment (like the


Python shell) that reads input, evaluates it, prints the result, and loops.

 requests: A popular Python library for making HTTP requests to interact with web
services and APIs.

 Return Value: The value that a function sends back to the part of the program that
called it, typically specified with the return statement.

 round(): A built-in Python function that rounds a floating-point number to a specified


number of decimal places or to the nearest integer.

 Round-off Error: Inaccuracies in floating-point arithmetic due to the limited precision


with which computers can represent decimal numbers.

 Scope: The region of a program where a particular variable or function can be


accessed.

 self: A convention in Python class methods referring to the instance of the class on
which the method is called.

 set: A mutable, unordered collection of unique elements in Python.

 snake_case: A naming convention where words are separated by underscores, and


all letters are lowercase (e.g., first_name). Recommended for Python variable and
function names.

 soft_skills: Non-technical skills such as communication, teamwork, and problem-


solving, which are crucial for professional success.

 sort(): A list method that sorts the elements of the list in-place (modifies the original
list).

 speech_recognition: A Python library for performing speech recognition, converting


spoken audio into text.

 Standard Library: A collection of built-in modules and functions that come with
Python, supporting common programming tasks.

 Statement: A unit of code in Python that the interpreter can execute (e.g., an
assignment, a print() call).

 String (str): An immutable sequence of characters in Python, typically enclosed in


single or double quotes.
 String Slicing: A technique to extract a portion (substring) of a string by specifying
start, end, and step indices.

 Subclass: A class that inherits attributes and methods from another class (its
superclass).

 sum(): A built-in Python function that returns the sum of all elements in an iterable.

 Superclass: A class from which other classes (subclasses) inherit attributes and
methods.

 Syntax: The set of rules that define the combinations of symbols that are considered
to be correctly structured statements or expressions in a programming language.

 Syntax Error: An error that occurs when a program violates the grammatical rules of
the programming language.

 Text-to-Speech (TTS): The synthesis of spoken language from text.

 try Block: The part of a try-except statement where code that might raise an
exception is placed.

 Tuple (tuple): An immutable, ordered collection of items in Python, enclosed in


parentheses ().

 Type Conversion: The process of converting a value from one data type to another
(e.g., int(), float(), str()).

 Variable: A named storage location in a program that holds a value.

 Version Control: A system that records changes to a file or set of files over time so
that you can recall specific versions later (e.g., Git).

 Virtual Environment: An isolated Python environment that allows projects to have


their own dependencies, independent of other projects or the system-wide Python
installation.

 walrus operator (:=): An assignment expression (introduced in Python 3.8) that


allows assigning a value to a variable as part of a larger expression.

 while loop: A control flow statement that repeatedly executes a block of code as long
as a given condition remains true.

 write(): A file method that writes a string to an o

You might also like