About 11,400,000 results
Open links in new tab
  1. Python Functions - W3Schools

    In Python a function is defined using the def keyword: To call a function, use the function name followed by parenthesis: Information can be passed into functions as arguments. Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, just separate them with a comma.

  2. How to Define and Call a Function in Python | GeeksforGeeks

    Dec 16, 2024 · By using the word def keyword followed by the function's name and parentheses we can define a function. If the function takes any arguments, they are included inside the parentheses. The code inside a function must be indented after the colon to indicate it …

  3. How To Define a Function in Python - LearnPython.com

    Apr 15, 2021 · Learn how to improve code structure and reusability by defining your own functions in Python. Examples and best practices are included!

  4. How to Define a Function in Python? - Python Guides

    Feb 10, 2025 · Learn how to define a function in Python using the `def` keyword, parameters, and return values. This step-by-step guide includes examples for easy understanding

  5. Python Functions - GeeksforGeeks

    Mar 10, 2025 · We can define a function in Python, using the def keyword. We can add any type of functionalities and properties to it as we require. By the following example, we can understand how to write a function in Python. In this way we can …

  6. How to Call a Function in Python – Def Syntax Example

    Jul 20, 2022 · To define a function in Python, you type the def keyword first, then the function name and parentheses. To tell Python the function is a block of code, you specify a colon in front of the function name. What follows is what you want the function to do. The basic syntax of a function looks like this: An example of a function looks like this:

  7. How To Define Functions in Python 3 - DigitalOcean

    Aug 20, 2021 · In this tutorial, we’ll go over how to define your own functions to use in your coding projects. You should have Python 3 installed and a programming environment set up on your computer or server.

  8. Python Function: The Basics Of Code Reuse

    Oct 31, 2023 · Learn how to create and use a Python function with Python's def keyword, why functions are useful, and learn about variable scope.

  9. How to Define a Function in Python

    Oct 18, 2023 · To define a function in Python, you use the def keyword followed by the name of the function, a list of parameters in parentheses, and a colon :. Here’s an example of a simple function that takes two arguments, x and y , and returns their sum:

  10. Python Functions - Python Guides

    What are Functions in Python? A function is a block of organized, reusable code that performs a specific task. Functions help break our program into smaller and modular chunks, making it more organized and manageable. Defining a Function. In Python, you define a function using the def keyword, followed by the function name and parameters in ...

  11. Some results have been removed
Refresh