Category Built-in Methods

Lowest Python Values with min()

Lowest Python Values with min()

Comparing a few Python values or finding the smallest item in a list calls for a way to select the minimum. min() returns the lowest item from an iterable or from separate arguments. This article explains both ways to use…

Convert String to Int in Python

Convert String to Int Python with int() and str()

A Python program may receive digits as text but need a numeric value for whole-number arithmetic. The built-in int() parses integer text into an integer, while str() turns a number into text again. I’ll show how int() converts integer text,…

Python xrange: Meaning and Migration

Python xrange: Meaning and Migration

Updating Python code that uses xrange() starts with knowing which Python version the code targets. In Python 2, xrange() provides an immutable integer sequence for loops, while Python 3 uses range() for that job. This article explains what xrange() did…

Python zip() Function: Pair Iterables

Python zip() Function: Pair Iterables

Related values often arrive in separate lists, such as names in one list and scores in another. Python’s zip() function pairs items at matching positions and returns an iterator that yields tuples. I’ll explain what zip() returns and show how…