About 1,280,000 results
Open links in new tab
  1. Python Functions (With Examples) - Programiz

    A function is a block of code that performs a specific task. In this tutorial, we will learn about the Python function and function expressions with the help of examples.

  2. 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 …

  3. Python def Keyword - GeeksforGeeks

    Dec 27, 2024 · In this example, we have created a user-defined function using the def keyword. The program defines a function called fun () using the def keyword. The function takes a single …

  4. 16 Python Functions Exercises and Examples - Pythonista Planet

    Once you define a function, you can call the function name whenever you want to use it. In Python, we can create our own functions by using the def keyword. The syntax is as follows.

  5. Functions in Python – Explained with Code Examples

    Jul 28, 2021 · You need to use the def keyword, give your function a name, followed by a pair of parentheses, and end the line with a colon (:). If your function takes arguments, the names of …

  6. Functions in Python (With Examples) - Python Tutorial

    Function definitions always start with the def keyword. Functions can be reusable, once created a function can be used in multiple programs. The print function is an example of that.

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

    Feb 10, 2025 · To define a function in Python, you use the def keyword followed by the function name and parentheses. Inside the parentheses, you can specify parameters that the function …

  8. Python Functions (With Examples) - TutorialsTeacher.com

    We will now see how to define and use a function in a Python program. A function is a reusable block of programming statements designed to perform a certain task. To define a function, …

  9. An Essential Guide to Python Functions By Examples

    In this tutorial, you’ll learn how to define user-defined Python functions. Here’s a simple function that shows a greeting: print('Hi') Code language: Python (python) This example shows the …

  10. Python Function: The Basics Of Code Reuse • Python Land Tutorial

    Oct 31, 2023 · We define a Python function with the def keyword. But before we start doing so, let’s first go over the advantages of functions, and let’s look at some built-in functions that you …

  11. Some results have been removed
Refresh