---
title: Built-In Functions in Python Programming
description: Learn about essential built-in Python functions like max(), min(), sum(), chr(), ord(), reversed(), and sorted() to streamline your coding process and enhance efficiency.
---

[Learn Computing from the Experts | The Rheinwerk Computing Blog](https://blog.rheinwerk-computing.com)

# [Built-In Functions in Python Programming](https://blog.rheinwerk-computing.com/built-in-functions-in-python-programming)

 Written by [Rheinwerk Computing](https://blog.rheinwerk-computing.com/author/rheinwerk-computing) | Oct 14, 2024 1:00:00 PM

Even without integrating an additional module in Python, you have access to a whole range of built-in functions.

 

This table contains an overview of just some of the built-in functions in [Python](https://learning.rheinwerk-computing.com/python).

 

 

## The max(), min(), and sum() Functions

The built-in max() and min() functions return the largest or smallest value of an iterable. The sum() function returns the sum of the elements of an iterable and is called with only one parameter.

 

Let’s look at an example using all three functions.

 

`print("Max. value of a tuple:", max(3, 2, -7))`

`print("Min. value of a set:", min(set([3, 2, 3])))`

`print("Sum of a tuple:", sum((3, 2, -7)))`

The following output is generated:

 

`Max. value of a tuple: 3`

`Min. value of a set: 2`

`Sum of a tuple: -2`

 

In this case, the max() function is called with several parameters that form a tuple of values, the largest element of which is determined. The min() function is called for a set. The individual parameter of the sum() function is a tuple that must be created before the function call using parentheses.

 

## The chr() and ord() Functions

The built-in chr() function returns the corresponding character for a Unicode number. Conversely, you can use the built-in ord() function to obtain the Unicode number for a character. Let’s consider an example.

 

`for i in range(48,58):`

`   print(chr(i), end="")`

`print()`

 

`for i in range(65,91):`

`   print(chr(i), end="")`

`print()`

 

`for i in range(97,123):`

`   print(chr(i), end="")`

`print()`

 

`for z in "abcde":`

`   print(ord(z), end=" ")`

`print()`

 

`for z in "abcde":`

`   print(chr(ord(z)+1), end="")`

The following output is generated:

 

`0123456789`

`ABCDEFGHIJKLMNOPQRSTUVWXYZ`

`abcdefghijklmnopqrstuvwxyz`

`97 98 99 100 101`

`bcdef`

 

Positions 48 to 57 in Unicode contain the digits 0 to 9. The uppercase and lowercase letters are in positions 65 to 90 and 97 to 122 in Unicode.

 

In the last part of this program, each character of a string is converted into the character following it in the code. This part could be an example of a simple encryption process.

## The reversed() and sorted() Functions

The built-in reversed() function returns the elements of a sequence in reverse order. The built-in sorted() function is used to create and deliver a sorted list of the elements in a sequence.

 

In our next example, these two functions are applied to a tuple and the values view of a dictionary.

 

`t = 4, 12, 6, -2`

`print("Tuple:", t)`

`print("Reversed: ", end="")`

`for i in reversed(t):`

`   print(i, end=" ")`

`print()`

`print("Sorted:", sorted(t))`

`print()`

`dc = {"Peter":31, "Judith":28, "William":35}`

`print("Dictionary:", dc)`

`va = dc.values()`

`print("Values view:", va)`

`print("Reversed: ", end="")`

`for i in reversed(va):`

`   print(i, end=" ")`

`print()`

`print("Sorted:", sorted(va))`

The following output is generated:

 

`Tuple: (4, 12, 6, -2)`

`Reversed: -2 6 12 4`

`Sorted: [-2, 4, 6, 12]`

 

`Dictionary: {'Peter': 31, 'Judith': 28, 'William': 35}`

`Values view: dict_values([31, 28, 35])`

`Reversed: 35 28 31`

`Sorted: [28, 31, 35]`

 

The reversed() function returns a sequence that contains the elements in reverse order. They can be output using a for loop. In the case of the reversed tuple, it is an object of the reversed type; in the case of the dictionary’s values view, it is an object of the dict\_reversevalueiterator type.

 

The sorted() function returns a list containing the elements of the sequence in sorted order. Numbers are sorted in ascending order by value; characters are sorted in ascending order by code number.

 

Editor’s note: This post has been adapted from a section of the book *[Getting Started with Python](https://www.sap-press.com/getting-started-with-python_5876/?utm_source=sappressblog&utm_medium=referral&utm_campaign=Blogs&utm_term=2586_chapter5&utm_content=2586)* by Thomas Theis.

[View full post](https://blog.rheinwerk-computing.com/built-in-functions-in-python-programming)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Rheinwerk Computing"
  },
  "dateModified" : "2024-10-17T13:12:38.862Z",
  "datePublished" : "2024-10-14T13:00:00Z",
  "headline" : "Built-In Functions in Python Programming",
  "image" : {
    "@type" : "ImageObject",
    "height" : 443,
    "url" : "https://5707200.fs1.hubspotusercontent-na1.net/hubfs/5707200/Built-In%20Functions%20in%20Python%20Programming.png",
    "width" : 1440
  },
  "mainEntityOfPage" : "https://blog.rheinwerk-computing.com/built-in-functions-in-python-programming",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 0.0,
      "url" : "https://5707200.fs1.hubspotusercontent-na1.net/hubfs/5707200/publishing_computing_logo.svg",
      "width" : 0.0
    },
    "name" : "Blog"
  }
}
```