Functions

Functions

Python Function Annotations and Type Hints: A Practical, Example-Rich Guide

Introduction to Function Annotations and Type Hints in Python When a function has several parameters, it can become difficult to tell what kind of values each parameter is expected to receive. The same problem can happen with the value returned by the function. For example, when you see a function like calculate_total(price, quantity), you may

Python Function Annotations and Type Hints: A Practical, Example-Rich Guide Read Post »

Functions

Advanced Function Concepts in Python: Examples, Uses and Application

Introduction: Advanced Function Concepts in Python Python functions can do much more than simply accept arguments and return values. As programs become more complex, functions can be stored in variables, passed to other functions, returned from functions, and used to preserve information between calls. These features make Python functions flexible and powerful. They are also

Advanced Function Concepts in Python: Examples, Uses and Application Read Post »

Functions

Variable Scope Concepts in Python: Important Concepts and Differences

Introduction: Variable Scope Concepts in Python Some variable scope concepts in Python apply to more than one topic, such as local variables, global variables, and the global keyword. These shared concepts are collected on this page so the same explanation does not need to be repeated across multiple tutorials. Quick Navigation Local and Global Variables

Variable Scope Concepts in Python: Important Concepts and Differences Read Post »

Functions

Python nonlocal Keyword: Syntax, Uses, Examples and Common Mistakes

Before learning the nonlocal keyword, let’s understand what an enclosing function is. What Is an Enclosing Function? When a function is defined inside another function, the outer function is called the enclosing function and the function defined inside it is called the nested function. def outer(): # Enclosing function def inner(): # Nested function print(“Hello”)

Python nonlocal Keyword: Syntax, Uses, Examples and Common Mistakes Read Post »

Scroll to Top