Better Programming

Advice for programmers.

Follow publication

Member-only story

7 Useful Python Built-In Functions

Artturi Jalli
Better Programming
Published in
4 min readMay 20, 2021
Devices on table
Photo by David Nicolai on Unsplash.

Python has a variety of practical built-in functions and types available by default. In this article, I will explain seven of them and provide some simple and beginner-friendly examples.

I hope you enjoy it!

1. isinstance()

You can use the isinstance() function to check if an object is an instance of some class. This is super useful when performing object-type comparisons. For instance:

Notice how the class info is a tuple in the last line ((list, float, int, bool)) and the return value is True. This is because the isinstance() function checks if any of the objects is an instance of any of them.

2. map()

The map() function is a replacement for a for loop. It applies a function for each element of a list, for example. The map() function returns a map object. This can easily be converted back to a list with the list() function.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Write a response