About 339 results
Open links in new tab
  1. Python Functions - W3Schools

    A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result. 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.

  2. Python Functions - GeeksforGeeks

    Mar 10, 2025 · In Python, functions are first-class objects, allowing them to be assigned to variables, passed as arguments and returned from other functions. This enables higher-order functions, closures and dynamic behavior.

  3. Functions in Python

    Learn about functions in Python, their types and different properties. See built in functions and user defined functions.

  4. How To Define a Function in Python | LearnPython.com

    Apr 15, 2021 · What Is a Function in Python? In programming, a function is a block of code that performs a certain task or a group of related tasks. If you notice that you often use the same block of code over and over again, consider writing a corresponding function.

  5. 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.

  6. Python Functions - Python Guides

    In Python, you define a function using the def keyword, followed by the function name and parameters in parentheses: def function_name(parameters): """Docstring: explains what the function does""" # Function body # Code to execute return result # Optional return statement

  7. Functions in Python | Definition, Types and Examples - Simplilearn

    Apr 12, 2025 · Python Functions are fundamental building blocks in programming, enabling code reusability, organization, and modularity. This comprehensive guide will teach you everything about Python functions, from basic definitions to advanced concepts.

  8. Python Functions: Definition, Arguments, Return, and Scope

    A lambda function is a small, anonymous function defined using the lambda keyword. It can have any number of arguments but only one expression, which is evaluated and returned. Lambda functions are often used for short, simple operations, especially in places where a full function definition is unnecessary, like with map(), filter(), or sorting.

  9. Python Function Definition: A Comprehensive Guide

    Mar 18, 2025 · What is a Function? A function in Python is a named block of code that performs a specific task. It takes zero or more inputs (arguments), processes them, and may return a value. Functions help in avoiding code duplication and provide a way to structure your program logically. The basic syntax for defining a function in Python is as follows:

  10. Understanding Function Definitions in Python - CodeRivers

    Jan 24, 2025 · A function in Python is a reusable block of code that performs a particular task. It takes zero or more inputs (arguments), processes them, and may return a value. For example, a function could be designed to calculate the square of a …

  11. Some results have been removed