Category: Python tutorial
-
Multi-Line Statements and Multi-Line Strings in Python
Introduction When we write Python programs, we often think of code simply as lines written one after another in a file, but internally, Python does not interpret code strictly based on how we physically write it. Instead, Python distinguishes between what we see as lines of code and what it actually executes as logical statements.…
-
Python Type Hierarchy
1. Introduction When we begin learning Python, we usually start with simple data types like integers, lists, or dictionaries, and we learn how to use them in isolation without thinking much about how they relate to each other internally. However, as we progress toward becoming an advanced Python developer, it becomes extremely important to understand…
-
Python Arithmetic Operators Tutorial
In this tutorial, we will discuss Arithmetic Operators in Python.Although these operators look similar to those in C, C++, Java, and other languages, Python includes a few additional operators and some important behavioral differences that every developer must understand—especially regarding division and floor division. This tutorial covers all seven arithmetic operators in Python, their rules,…
-
Python Escape Characters, Comments, and Constants
In this tutorial, we cover three important topics: • Escape characters in Python• Writing comments (single-line and multi-line)• Whether constants exist in Python These topics are fundamental for writing clean, readable, and maintainable Python programs.This tutorial follows the same detailed formatting as your earlier Python tutorials. 1. Escape Characters in Python Escape characters are special…
-
Python None Data Type
This tutorial explains the None data type in Python. The concept of None often appears simple, but it has several important uses such as representing no value, empty results, missing data, default initialization, and function return values. This tutorial covers: what None means, when to use it, how Python treats None internally, the type of…
-
Python Bytes and Bytearray Data Types
This tutorial explains two closely related but different Python data types: bytes and bytearray.These types are not very commonly used in day-to-day Python programming, but they are extremely important when dealing with binary data such as images, audio files, video files, and network streams. Understanding these types is essential when working at a lower level…
-
Python Range Data Type
This tutorial explains the Python range data type in a detailed, step-by-step format. It covers what a range is, how to create range objects, how many forms are available, how indexing and slicing work, the role of step values for increments and decrements, the immutability of range objects, and several illustrative examples. The format follows…
-
Dictionary (dict) in Python
This tutorial provides a complete and detailed explanation of Python dictionaries, how they work internally, how to create, access, update, and delete elements, and how dictionaries behave in real-world programs. The structure follows the same format as your earlier Python tutorials on int, float, complex, typecasting, and immutability. 1. Introduction to Python Dictionaries A dictionary…
-
Python Frozen Set Tutorial
Introduction Up to this point, we have already covered three major Python data structures: list, tuple, and set. Each of them addresses different requirements depending on whether you need ordering, mutability, or uniqueness. Before learning frozen sets, it is important to recall the core behavior of these three data types so the concept of a…
-
Python Set tutorial
Introduction In Python programming, we sometimes need to represent a group of values where the order of elements does not matter, and duplicates should be removed automatically. Lists and tuples allow duplicates and preserve order, but certain situations require the exact opposite. For example, if you are sending SMS messages to a group of students…
