Functions

Built-in function examples

Built-in library functions are functions that are created as part of the computer language. For example: round() and len(). These built-in functions are there to make our life easier when programming. Below are a couple of Python built-in library functions that you may use this year.

Built-in function Description Example Output
round() Returns number to a specified number of decimal places
number = 3.14159
rounded_number = round(number)
print("Rounded number:", rounded_number)
Rounded number: 3
len() Returns the length of a string
my_string = "Hello, Python!" 
print("Length of the string:", len(my_string))
Length of the string: 13

There are a number of built-in functions programmed in a computer language. W3Schools has a list of built-in functions within Python.