Built-in Functions in Python
Built-in functions in Python are functions always available without any import, like type(), len(), range(), round(), max(), min(), and sum() — they cover type checking, numbers, and generating sequences.
Some tools are so commonly needed that Python does not make you import anything — they are always available the moment you start Python. These are called built-in functions in Python. Unlike modules like math and random, you never write an import line to use them.
This page rounds up the built-ins you'll use constantly: checking and converting types, working with numbers, measuring things, and generating sequences.
What you will learn
- How
type()andisinstance()differ - Converting between types with
int(),float(),str() - Number built-ins:
abs(),round(),pow(),max(),min(),sum() - Measuring things with
len() - Generating sequences of numbers with
range()
Checking and converting types
type(42) # <class 'int'> tells you what type something is
type(3.14) # <class 'float'>
type('hello') # <class 'str'>
isinstance(42, int) # True is 42 an integer? yes
isinstance(3.14, int) # False is 3.14 an integer? no
isinstance('hello', str) # True is 'hello' a string? yestype() tells you what kind of thing something is. isinstance() asks a yes-or-no question — is this thing a particular type? — which makes it handy for guarding functions against bad input, as covered in Recursion in Python.
You can also convert between types (full details in Type Casting in Python):
int(3.9) # 3 cuts off the decimal (does NOT round)
float(5) # 5.0 turns a whole number into a decimal
str(42) # '42' turns a number into textThese are useful when, for example, you want to join a number into a sentence — Python will not let you stick a number and a string together directly, but if you convert the number to a string first, it works fine.
Numbers
abs(-7) # 7 the absolute value (removes the minus sign)
round(3.7) # 4 rounds to nearest whole number
round(3.14159, 2) # 3.14 rounds to 2 decimal places
pow(2, 8) # 256 2 to the power of 8
max(3, 7, 2) # 7 the largest value
min(3, 7, 2) # 2 the smallest value
sum([1, 2, 3, 4]) # 10 adds everything in a listround() is the one to reach for when you actually want rounding behavior — unlike int(), which always truncates toward zero regardless of how close a value is to the next whole number.
Measuring things: len()
len('hello') # 5 how many characters in a string
len([10, 20, 30]) # 3 how many items in a listlen() is one of the most used functions in Python — it works on strings, lists, and many other collection types.
Generating sequences of numbers: range()
range(5) # 0, 1, 2, 3, 4
range(1, 6) # 1, 2, 3, 4, 5
range(0, 10, 2) # 0, 2, 4, 6, 8 (step of 2)range() gives you a sequence of numbers. You will use this constantly in loops — for example, for i in range(5) repeats something five times. The sequence always stops before the last number you give it — range(5) never includes 5 itself.
Common mistakes
- Comparing a boolean result with
== Trueinstead of using it directly - Expecting
int()to round likeround()does — it truncates instead - Assuming
range(5)includes5— it stops one before the end value - Calling
len()on something that has no length, like an integer, and hitting aTypeError - Confusing
type(), which tells you the exact type, withisinstance(), which answers a yes/no question
Common questions
What are built-in functions in Python?
Built-in functions are functions that are always available in Python without needing to import anything, such as type(), len(), range(), print(), max(), min(), and round().
What is the difference between type() and isinstance()?
type() returns the exact type of a value, like
. isinstance() answers a yes/no question about whether a value is a specific type, returning True or False, and is the preferred way to check types in conditionals. Does round() work the same as int() in Python?
No. round() rounds to the nearest whole number (or a given number of decimal places), while int() truncates — it simply chops off the decimal part regardless of how close it is to rounding up.
Does range(5) include the number 5?
No. range(5) produces 0, 1, 2, 3, 4 — it always stops one before the value you give it as the end.
What does len() do in Python?
len() returns the number of items in a sequence, such as the number of characters in a string or the number of elements in a list.
Explore
Related topics
Keep going — these sit next to this concept in a real learning path.
Functions in Python: Definition and How They Work
How def, parameters, and return values work.
Libraries and Modules in Python
Functions that do need an import, like math and random.
Type Casting in Python
The int(), float(), and str() conversion functions in depth.
Python course hub
All free Python explainers and the path into Agentic practice.
Functions in Python in Depth: The Complete Guide
Default args, *args/**kwargs, lambdas, and scope — all in one.