Learning and practicing advanced Python topics
- Neural Nine Python Advanced Tutorials Playlist
- Patrick Loeber Advanced Python - Complete Course Playlist
- Advanced Python Tutorials from learnpython.org
- Decorators
- Closures
- Generators
- Iter tools
- List Comprehension
- Lambda Functions
- Map, Filter, Reduce
- Sets
- Magic Functions/Dunder Methods
- Multiple Function Arguments
- Shallow vs Deep Copying
- Collections
- Serialization
- Threading
- Multiprocessing
- JSON in Python
- Parsing CSV Files
- Asterisk
- Regular Expressions
- Exception Handling
- Encapsulation
- Type Hinting
- Partial Functions
- Context Managers
- Logging
- Code Introspection
- Argument Parsing
- Exercise: Create a
timerdecorator that measures how long a function takes to execute. - Exercise: Create a
retrydecorator that retries a function a specified number of times if it raises an exception. - Exercise: Create a closure that keeps a count of how many times a function is called.
- Exercise: Create a generator function that generates Fibonacci numbers up to a specified value.
- Exercise: Use
itertoolsto generate an infinite cycle of a list of items (['A', 'B', 'C']). - Exercise: Use
itertoolsto generate all combinations of a list of numbers.
- Exercise: Create a list comprehension that generates all even numbers between 1 and 100.
- Exercise: Use a lambda function and
mapto square all numbers in a list. - Exercise: Use
filterand lambda to filter out numbers divisible by 3 from a list.
- Exercise: Create a function that accepts any number of positional arguments and keyword arguments and prints them.
- Exercise: Create a function that unpacks a list of values into separate arguments.
- Exercise: Write a function that uses regex to validate an email address.
- Exercise: Create a function that extracts all phone numbers from a text string.
- Exercise: Create a function that divides two numbers and handles
ZeroDivisionError,TypeError, andValueError. - Exercise: Create a custom exception
InsufficientFundsErrorfor a banking application.
- Exercise: Create a function that takes two lists and returns the common elements using sets.
- Exercise: Use
collections.Counterto count the frequency of words in a string.
- Exercise: Create a function that serializes a Python dictionary to a JSON file.
- Exercise: Write a function that reads a CSV file and converts it to a list of dictionaries.
- Exercise: Create a nested list and demonstrate the difference between shallow and deep copying using
copyanddeepcopy.
- Exercise: Create a class
Pointwith__add__and__str__dunder methods for adding two points and printing them. - Exercise: Create a class
Counterthat has a__call__method to count the number of times it is called.
- Exercise: Create a class
BankAccountwith private attributes for balance and methods to deposit and withdraw. - Exercise: Add type hints to all the methods in the class.
- Exercise: Use
functools.partialto create a function that always adds 10 to any number.
- Exercise: Create a program that calculates the sum of a list of numbers using threading.
- Exercise: Create a program that calculates the factorial of a number using multiprocessing.
- Exercise: Create a custom context manager using a class for opening and closing a file.
- Exercise: Create a context manager using the
@contextmanagerdecorator to temporarily change the working directory.
- Exercise: Implement a
ShapeFactoryusing the Factory pattern that returns different shape objects. - Exercise: Implement a Proxy pattern where an object is used to control access to a sensitive resource.
- Exercise: Implement a Singleton class
DatabaseConnectionthat ensures only one connection object exists.
- Task Manager CLI:
- Use
argparsefor command-line arguments. - Use JSON for saving task data.
- Use threading to allow for timer-based tasks.
- Use decorators for logging.
- Use
- Personal Finance Tracker:
- Use JSON for storing expenses.
- Use CSV for importing and exporting expense data.
- Use regex for validating descriptions and amounts.
- Use a Factory pattern for creating different types of transactions (Expense, Income).
- File Organizer:
- Use threading to speed up file moving.
- Use context managers to handle file operations.
- Use closures for counting the number of files organized.
- Use sets to avoid duplicate file names.
- Quiz Application:
- Use decorators to log user scores.
- Use context managers for file handling (question bank).
- Use JSON to save user progress.
- Use closures for tracking score across multiple attempts.
- Chatbot with Custom Commands:
- Use regex to detect commands.
- Use a Proxy pattern for restricted commands.
- Use type hinting for better code quality.
- Use threading for asynchronous command handling.