Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Built-in Functions | Functions & Modularity
Introduction to Python with Cursor

bookBuilt-in Functions

Python comes with dozens of built-in functions — no import needed. They help you transform, measure, or convert values in one line of code.

Functions are grouped by purpose: numbers, text, types, and collections.

Converting Data Types

These functions helps to convert between basic types:

  • int() — to integer;
  • float() — to float;
  • str() — to string;
  • bool() — to boolean.

Useful when working with input, formatting, or expressions.

Working with Numbers

These help clean or adjust numeric values:

  • abs() — absolute value (removes minus sign);
  • round() — rounds floats to nearest whole or to decimals.

Working with Strings

These are commonly used for cleaning and formatting text:

  • lower() — make all letters lowercase;
  • upper() — make all letters uppercase;
  • strip() — remove spaces at the beginning and end;
  • replace() — replace part of a string with another;
  • split() — turn a string into a list of words;
  • join() — combine list items into one string.

Collection Inspection

These return information about a list, tuple, or other iterable:

  • len() — count items;
  • max() — largest value;
  • min() — smallest value;
  • sum() — total of all numbers.

Collection Transformation

These are helpful when looping, combining, or transforming collections:

  • sorted() — returns sorted list;
  • enumerate() — adds index numbers;
  • zip() — pairs items from multiple lists;
  • range() — creates a sequence of numbers;
  • map() — applies a function to each item;
  • filter() — keeps items that meet a condition.

Summary

  • Python's built-in functions save you time and code;
  • You can convert data, adjust text, transform collections, and get answers instantly;
  • These tools become essential as you build more complex programs.
question mark

What does len("Python") return?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 1

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you explain how to use int(), float(), str(), and bool() with different data types?

What are some common mistakes when converting between types in Python?

Can you show what happens if a conversion fails?

Awesome!

Completion rate improved to 5

bookBuilt-in Functions

Swipe to show menu

Python comes with dozens of built-in functions — no import needed. They help you transform, measure, or convert values in one line of code.

Functions are grouped by purpose: numbers, text, types, and collections.

Converting Data Types

These functions helps to convert between basic types:

  • int() — to integer;
  • float() — to float;
  • str() — to string;
  • bool() — to boolean.

Useful when working with input, formatting, or expressions.

Working with Numbers

These help clean or adjust numeric values:

  • abs() — absolute value (removes minus sign);
  • round() — rounds floats to nearest whole or to decimals.

Working with Strings

These are commonly used for cleaning and formatting text:

  • lower() — make all letters lowercase;
  • upper() — make all letters uppercase;
  • strip() — remove spaces at the beginning and end;
  • replace() — replace part of a string with another;
  • split() — turn a string into a list of words;
  • join() — combine list items into one string.

Collection Inspection

These return information about a list, tuple, or other iterable:

  • len() — count items;
  • max() — largest value;
  • min() — smallest value;
  • sum() — total of all numbers.

Collection Transformation

These are helpful when looping, combining, or transforming collections:

  • sorted() — returns sorted list;
  • enumerate() — adds index numbers;
  • zip() — pairs items from multiple lists;
  • range() — creates a sequence of numbers;
  • map() — applies a function to each item;
  • filter() — keeps items that meet a condition.

Summary

  • Python's built-in functions save you time and code;
  • You can convert data, adjust text, transform collections, and get answers instantly;
  • These tools become essential as you build more complex programs.
question mark

What does len("Python") return?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 1
some-alt