Category Built-in Methods

Slice Function Python: How to Use It

Slice Function Python: How to Use It

When a Python task calls for selecting part of a sequence, you can describe the selection with slice(). Python’s slice() creates an object that stores bounds for use inside square brackets. This article shows how to save a slice object…

How to Use Input Function in Python

How to Use Input Function in Python

A calculation in Python may need a number read while the program runs. Python’s input() reads one line from standard input and returns it as text. This article explains how to convert numeric text and check what happens when the…

How to Open Files in Python

How to Open Files in Python

To read information saved in a file, your Python program first needs to open it. Python’s built-in open() function opens a path and returns a file object your program can use to read or write data. This article shows how…

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,…