Link Search Menu Expand Document

Built-in Functions

Table of contents

  1. Description
  2. Invocation
  3. Example
    1. Line 1
    2. Line 2
    3. Line 3
    4. Line 4
    5. Line 5

Description

Built-in functions are pre-installed with the Python language. They do not need to be imported or created by the programmer. Common built-in functions are print(), input(), and len()

Invocation

When invoking (calling/executing) a function, you type it’s name followed by opening and closing parenthesis.

  • Arguments: Some functions accept arguments (input), which are placed inside the parenthesis.
  • Return Value: Some functions produce output, and return it to its caller.

Example

Line 1

  • Function: input
  • Argument(s): 'Hi! What\'s your name? '
  • Return Value: User input

Line 2

  • Function: print
  • Argument(s): n-a
  • Return Value: n-a

Line 3

  • Function: print
  • Argument(s): f'Nice to meet you, {name.title()}.'
  • Return Value: n-a

Line 4

  • Function: len
  • Argument(s): name (a variable)
  • Return Value: length of variable

Line 5

  • Function: print
  • Argument(s): f'Your name has {characters} characters.'
  • Return Value: n-a