Python Refresher for DSA

Python Refresher for DSA

Python Refresher for DSA Table of Contents What You Will Learn in This Blog Python Built-in Data Types for DSA Lists Dictionaries Sets Tuples The Collections Module deque defaultdict Counter List Comprehensions Important Built-in Functions for DSA Sorting in Python String Operations heapq – The Built-in Min Heap Common Python Patterns in DSA Summary Key Takeaways Next Steps What You Will Learn in This Blog The Python built-in data types you will use constantly in DSA How lists, dictionaries, sets, and tuples work and when to use each Important Python built-in functions and their complexities The collections module – deque, defaultdict, Counter List comprehensions and when to use them Common Python patterns that appear repeatedly in DSA problems This is not a complete Python tutorial. It covers exactly what you need to follow the rest of this guide comfortably. If you are already confident with all of the above, you can skim this and move on. ...

March 21, 2026 · 16 min · 3233 words ·  · By codeverra

Regular Expressions in Python

Regular Expressions in Python Pattern Matching, Text Processing, and the re Module Before We Begin – Why Regular Expressions Matter Here is a real problem. You have a CSV file with 50,000 rows of customer data. The phone number column is a mess: +91-9876543210 9876 543 210 (091) 9876-543210 91-98765-43210 9876543210 +919876543210 All of these are the same phone number in different formats. You need to extract just the 10-digit number from all of them. ...

March 21, 2026 · 22 min · 4608 words ·  · By codeverra
Strings in DSA

Strings in Python - Complete Guide

Strings Table of Contents What You Will Learn in This Blog What is a String ASCII Unicode Strings in Python – Immutability String Operations and Time Complexity Common String Methods Strings as Arrays Patterns and Techniques Pattern 1 – Two Pointers on Strings Pattern 2 – Sliding Window on Strings Pattern 3 – Hashing for String Problems Summary Key Takeaways Practice Problems Next Steps What You Will Learn in This Blog What a string is at the byte level – characters, ASCII, and Unicode How Python represents strings in memory Why strings in Python are immutable and what that means in practice All common string operations and their time complexity How to build strings efficiently and avoid a common O(n^2) trap Three patterns applied to strings: Sliding Window, Two Pointers, and Hashing Solved LeetCode problems for each pattern with full explanation A practice problem table for further study What is a String At the most fundamental level, a string is a sequence of characters. But computers do not natively understand characters – they only understand numbers. So every character is mapped to a number, and that number is stored in memory. ...

March 21, 2026 · 20 min · 4117 words ·  · By codeverra

Type Hints in Python

Type Hints in Python Writing Code That Explains Itself – The typing Module and Beyond Before We Begin – Why Type Hints Matter Here is a function: def calculate_discount(price, discount, is_member): ... What type is price? A float? An int? A string like "1299"? What is discount? A percentage like 18.5? Or a multiplier like 0.185? What does is_member do to the result? You cannot tell without reading the implementation. In a codebase with hundreds of functions, this adds up to an enormous cognitive load. ...

March 21, 2026 · 16 min · 3344 words ·  · By codeverra

Working with the Real World in Python

Working with the Real World APIs, JSON, Dates, and HTTP Requests in Python Before We Begin – What Changes After This Guide Everything you have learned so far has worked entirely inside your own machine. You write code, it runs, it produces output, it reads files you already have. This guide is where that changes. After this guide your Python programs will be able to: Ask a server in another country for the current weather in Mumbai Get the latest currency exchange rate between INR and USD Pull real-time cricket scores from a sports API Send data to a web service and get a response back Work with dates and times the way real applications do This is not tutorial-level Python anymore. This is the Python that powers every data pipeline, every web application, every automation script, and every data science project that talks to the outside world. ...

March 21, 2026 · 37 min · 7715 words ·  · By codeverra
Python programming

Complete Guide to Numpy Library in Python

🔢 NumPy Masterclass and Practice Sheet From Zero to Confident - A Beginner’s Guide to Numerical Computing in Python Who is this for? You know Python basics - lists, loops, functions - and you want to level up into data science. NumPy is your first real step. Everything in data science (Pandas, Scikit-learn, TensorFlow) is built on top of it. 📌 Table of Contents What is NumPy and Why Should You Care? Installing and Importing NumPy Creating Arrays Array Attributes Indexing and Slicing Array Operations - Math Made Easy Universal Functions (ufuncs) Aggregation Functions Reshaping and Transposing Stacking and Splitting Arrays Boolean Masking and Fancy Indexing Broadcasting Working with Random Numbers Linear Algebra with NumPy Sorting and Searching Copies vs Views Saving and Loading Arrays Practice Questions What We Covered + What’s Next 1. What is NumPy and Why Should You Care? Python lists are flexible and easy to use - but they are slow when it comes to heavy number crunching. If you have a million exam scores and want to find the average, a Python loop will take noticeably longer than it should. ...

March 18, 2026 · 25 min · 5194 words · By codeverra
Python programming

Complete Guide to Pandas in Python

🐼 Pandas Masterclass From Raw Data to Real Insights - A Beginner’s Guide to Data Analysis in Python Who is this for? You’ve done the NumPy Masterclass (or know the basics of Python and arrays). Now you want to work with real tabular data - rows, columns, missing values, merges, and group-level summaries. That’s exactly what Pandas is for. 📌 Table of Contents What is Pandas and Why Do You Need It? Installing and Importing Pandas The Two Core Data Structures Creating DataFrames Reading and Writing Data Exploring a DataFrame Selecting Data - loc, iloc, and Column Access Filtering Rows Adding, Modifying, and Dropping Columns Sorting Data Handling Missing Data String Operations Working with Dates and Times apply(), map(), and applymap() GroupBy - Aggregation and Split-Apply-Combine Merging and Joining DataFrames Pivot Tables and Crosstabs Reshaping - melt() and stack()/unstack() MultiIndex DataFrames Performance Tips Practice Questions What We Covered + What’s Next 1. What is Pandas and Why Do You Need It? NumPy arrays are powerful, but they have one limitation: every column must be the same data type, and there are no column names or row labels. ...

March 18, 2026 · 30 min · 6333 words · By codeverra
Python programming

Master Collections in Python

Python Collections - Practice Questions and Solutions List, Tuple, Dictionary, Set – Complete Practice Set This practice set covers strings and all four major Python collections. Questions are grouped by collection type, then by difficulty within each section. The final section has mixed questions that combine multiple collections, loops, and conditionals. Try each question before reading the solution. Table of Contents Part 1 – Lists Part 2 – Strings Part 3 – Tuples Part 4 – Dictionaries Part 5 – Sets Part 6 – Mixed Questions Quick Reference Part 1 – Lists A list is an ordered, mutable collection. It allows duplicate values and supports indexing, slicing, appending, and sorting. ...

March 18, 2026 · 25 min · 5163 words · By codeverra
Python programming

Master Loops in Python

Python Loops - Practice Questions and Solutions 20 Questions from Easy to Hard All 20 questions are based on the Loops Masterclass. Try each question on your own before reading the solution. The questions are ordered by difficulty: Easy (1-7), Medium (8-14), Hard (15-20). Table of Contents Easy Questions (1-7) Medium Questions (8-14) Hard Questions (15-20) Easy Questions (1-7) Q1 – Basic for Loop with range() Print all numbers from 1 to 30 that are divisible by both 3 and 5. ...

March 18, 2026 · 15 min · 3085 words · By codeverra