Various Built In Functions

Python ships with a rich set of built-in functions that are always available, without needing any import. Knowing these well saves you from writing custom code for common, everyday tasks.

Commonly Used Built-In Functions

  • len() - returns the number of items in a list, string, or other collection
  • range() - generates a sequence of numbers, most often used in loops
  • map() - applies a function to every item in an iterable
  • filter() - keeps only the items in an iterable that satisfy a condition
  • zip() - combines multiple iterables together, element by element
  • sorted() - returns a new sorted list from any iterable
  • enumerate() - loops through an iterable while also tracking the index
names = ["Aman", "Priya", "Rohit"]
scores = [78, 92, 85]

for index, name in enumerate(names):
    print(index, name)

for name, score in zip(names, scores):
    print(name, "scored", score)

print(sorted(scores))          # [78, 85, 92]
print(sorted(scores, reverse=True))   # [92, 85, 78]
Relying on built-in functions instead of writing manual loops for common tasks generally makes your code shorter, faster, and easier for other developers to read.

Coming Up Next

With Python's functional toolkit covered, the course now shifts into Object Oriented Programming, starting with an introduction to its core concepts.

Ready to Master Data Science?

Join Uncodemy's Data Science Course and build real, job-ready skills with expert mentors.

Explore Course