DEV Community

Cover image for Day 17/100: Built-in Python Functions You Should Know
 Rahul Gupta
Rahul Gupta

Posted on

Day 17/100: Built-in Python Functions You Should Know

Welcome to Day 17 of the 100 Days of Python series!
Python comes packed with a set of powerful, ready-to-use tools known as built-in functions. These functions can save you time, simplify your code, and help you do everything from basic calculations to working with data types — no need to import anything!

Let’s explore some of the most useful built-in functions every Python developer should know.


📦 What You’ll Learn

  • What built-in functions are
  • Top 20+ built-in functions and how to use them
  • Real-world use cases
  • Bonus: how to discover more functions

🤔 What Are Built-in Functions?

Built-in functions are predefined functions that are always available in Python. You can use them anytime without importing a module.

Example:

print("Hello, Python!")  # ✅ print is a built-in function
Enter fullscreen mode Exit fullscreen mode

🚀 Most Common Built-in Functions (with Examples)

1. print() – Display output

print("Learning Python!")
Enter fullscreen mode Exit fullscreen mode

2. len() – Get the length of a string, list, etc.

name = "Python"
print(len(name))  # Output: 6
Enter fullscreen mode Exit fullscreen mode

3. type() – Find out the data type

print(type(5))       # <class 'int'>
print(type("Hello")) # <class 'str'>
Enter fullscreen mode Exit fullscreen mode

4. int(), float(), str() – Type casting

age = "25"
print(int(age))  # Converts string to integer
Enter fullscreen mode Exit fullscreen mode

5. input() – Take user input

name = input("Enter your name: ")
print("Hello,", name)
Enter fullscreen mode Exit fullscreen mode

6. sum() – Add all items in an iterable

numbers = [10, 20, 30]
print(sum(numbers))  # Output: 60
Enter fullscreen mode Exit fullscreen mode

7. max() / min() – Get highest/lowest value

print(max([3, 6, 2]))  # 6
print(min([3, 6, 2]))  # 2
Enter fullscreen mode Exit fullscreen mode

8. sorted() – Return a sorted list

print(sorted([5, 2, 9]))  # [2, 5, 9]
Enter fullscreen mode Exit fullscreen mode

9. range() – Generate a sequence of numbers

for i in range(3):
    print(i)  # 0, 1, 2
Enter fullscreen mode Exit fullscreen mode

10. enumerate() – Get index while looping

colors = ["red", "blue", "green"]
for index, color in enumerate(colors):
    print(index, color)
Enter fullscreen mode Exit fullscreen mode

11. zip() – Combine iterables element-wise

names = ["Alice", "Bob"]
scores = [85, 92]
for name, score in zip(names, scores):
    print(f"{name} scored {score}")
Enter fullscreen mode Exit fullscreen mode

12. abs() – Absolute value

print(abs(-7))  # 7
Enter fullscreen mode Exit fullscreen mode

13. round() – Round a number

print(round(3.14159, 2))  # 3.14
Enter fullscreen mode Exit fullscreen mode

14. all() / any() – Test multiple conditions

print(all([True, True, False]))  # False
print(any([False, False, True])) # True
Enter fullscreen mode Exit fullscreen mode

15. dir() – Show attributes/methods of an object

print(dir(str))  # Shows all string methods
Enter fullscreen mode Exit fullscreen mode

16. help() – Get documentation

help(len)  # Shows how len() works
Enter fullscreen mode Exit fullscreen mode

17. eval() – Execute a string as Python code (⚠️ use with caution)

expression = "3 + 5"
print(eval(expression))  # Output: 8
Enter fullscreen mode Exit fullscreen mode

18. reversed() – Reverse an iterable

for char in reversed("Python"):
    print(char, end="")  # nohtyP
Enter fullscreen mode Exit fullscreen mode

19. isinstance() – Check if a variable is of a type

x = 10
print(isinstance(x, int))  # True
Enter fullscreen mode Exit fullscreen mode

20. map() / filter() – Functional programming helpers

nums = [1, 2, 3]
squared = list(map(lambda x: x**2, nums))
print(squared)  # [1, 4, 9]

evens = list(filter(lambda x: x % 2 == 0, nums))
print(evens)  # [2]
Enter fullscreen mode Exit fullscreen mode

💡 Bonus Tip: Explore All Built-in Functions

Use this to see all available built-in functions:

print(dir(__builtins__))
Enter fullscreen mode Exit fullscreen mode

🧠 Recap

Today you learned:

  • What built-in functions are
  • 20+ of the most commonly used ones
  • How to use them to write cleaner, faster code
  • Where to find documentation using help() and dir()

Top comments (0)