Fundamentals 11 min read

Python Built‑in Functions and Common Usage

This article introduces Python's built‑in functions, data types, numeric conversions, mathematical utilities, sequence and collection constructors, iteration tools, scope inspection, dynamic code execution, memory introspection, file handling, and module import techniques, providing concise code examples for each concept.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Python Built‑in Functions and Common Usage

Python provides a set of built‑in functions such as print() , input() , abs() , len() , and many others (68 in version 3.6.2) that can be used directly without importing modules.

Common data types include bool , int , float , and complex ; conversion functions like bin() , oct() , and hex() change numbers between bases.

Mathematical utilities include abs() , divmod() , round() , pow() , sum() , min() , and max() .

Sequence constructors list() and tuple() create mutable and immutable collections; reversed() , slice() , and indexing provide slicing and iteration capabilities.

Mapping and set types are created with dict() and set() ; frozenset() creates an immutable set. Functions len() , sorted() , enumerate() , all() , any() , and zip() operate on iterables.

Sorting can be customized with sorted(iterable, key=func, reverse=True) ; examples show sorting by length.

Scope inspection functions locals() and globals() return current and global namespaces.

Iterator utilities include range() , iter() , next() , and generator‑style loops.

Dynamic code execution uses eval() , exec() , and compile() , while input() and print() handle I/O.

Memory‑related functions hash() and id() expose object identity; file handling uses open() .

Modules can be imported dynamically with __import__() , and help() and callable() provide introspection.

data typesstandard-librarybuilt-in-functionsfile handlingcode execution
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.