Python guides
Every published Python guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular Python guides
Most readLatest Python guides
Page 174 of 179Python Negative Modulo: Sign and Behavior Explained
Understand Python's negative modulo behavior: why the result takes the divisor's sign, how floor division and divmod relate, and where Python differs from C-like languages.
Python divmod: Getting Quotient and Remainder in One Call
python divmod: Learn how Python's divmod returns quotient and remainder together, its behavior with integers and floats, and practical use cases.
Python Modulo Operator: Behavior and Practical Use
Learn how Python's modulo operator returns remainders, why negative operands can be surprising, and how it works with floor division. Includes practical examples and edge cases such as division by zero and floating-point precision.
Python Division vs Floor Division: Key Differences
Learn the difference between Python's / and // operators, including behavior with negative numbers, floats, and practical use cases.
Python Floor Division: Behavior and Edge Cases
Understand how Python's // operator rounds toward negative infinity, how it relates to modulo, and when to prefer it over true division.
Python Integer Division: How // Works and When to Use It
Understand Python's floor division with //, including negative operands, floats, and when to use divmod() for quotient and remainder.
Python Integer Operations: Key Behaviors and Pitfalls
python integer operations: Understand Python integer operations: division, modulo, bitwise, arbitrary precision, and performance tradeoffs for large numbers.
Python int Usage: Conversion, Arithmetic, and Pitfalls
Understand the int() constructor, base conversion, arithmetic behavior, large integers, and common pitfalls for reliable Python code.
Python Mutable vs Hashable: What Every Developer Should Know
Understand why mutable built-in types are not hashable in Python, how hashability affects dict keys and set membership, and when to override __hash__ and __eq__ in custom classes.
Python Hashable Types: Dict Keys and Set Members
Learn what makes a Python type hashable, why dictionary keys and set members require it, and how to implement __hash__ and __eq__ correctly.