Tuple as function arguments in Python Last Updated : 01 Aug, 2020 Comments Improve Suggest changes Like Article Like Report Tuples have many applications in all the domains of Python programming. They are immutable and hence are important containers to ensure read-only access, or keeping elements persistent for more time. Usually, they can be used to pass to functions and can have different kinds of behavior. Different cases can arise. Case 1: fnc(a, b) - Sends a and b as separate elements to fnc. Case 2: fnc((a, b)) - Sends (a, b), whole tuple as 1 single entity, one element. Case 3: fnc(*(a, b)) - Sends both, a and b as in Case 1, as separate integers. The code below demonstrates the working of all cases : Python3 # Python3 code to demonstrate working of # Tuple as function arguments # function with default arguments def fnc(a=None, b=None): print("Value of a : " + str(a)) print("Value of b : " + str(b)) # Driver code if __name__ == "__main__" : # initializing a And b a = 4 b = 7 # Tuple as function arguments # Case 1 - passing as integers print("The result of Case 1 : ") fnc(a, b) # Tuple as function arguments # Case 2 - Passing as tuple print("The result of Case 2 : ") fnc((a, b)) # Tuple as function arguments # Case 3 - passing as pack/unpack # operator, as integer print("The result of Case 3 : ") fnc(*(a, b)) Output : The result of Case 1 : Value of a : 4 Value of b : 7 The result of Case 2 : Value of a : (4, 7) Value of b : None The result of Case 3 : Value of a : 4 Value of b : 7 Comment More infoAdvertise with us Next Article Tuple as function arguments in Python manjeet_04 Follow Improve Article Tags : Python Python tuple-programs Practice Tags : python Similar Reads Python function arguments In Python, function arguments are the inputs we provide to a function when we call it. Using arguments makes our functions flexible and reusable, allowing them to handle different inputs without altering the code itself. Python offers several ways to use arguments, each designed for specific scenari 3 min read Passing function as an argument in Python In Python, functions are first-class objects meaning they can be assigned to variables, passed as arguments and returned from other functions. This enables higher-order functions, decorators and lambda expressions. By passing a function as an argument, we can modify a functionâs behavior dynamically 5 min read Passing Dictionary as Arguments to Function - Python Passing a dictionary as an argument to a function in Python allows you to work with structured data in a more flexible and efficient manner. For example, given a dictionary d = {"name": "Alice", "age": 30}, you can pass it to a function and access its values in a structured way. Let's explore the mo 4 min read Types of Arguments in Python Arguments are the values passed inside the parenthesis of the function. A function can have any number of arguments separated by a comma. There are many types of arguments in Python .In this example, we will create a simple function in Python to check whether the number passed as an argument to the 3 min read type() function in Python The type() function is mostly used for debugging purposes. Two different types of arguments can be passed to type() function, single and three arguments. If a single argument type(obj) is passed, it returns the type of the given object. If three argument types (object, bases, dict) are passed, it re 5 min read Default arguments in Python Python allows function arguments to have default values. If the function is called without the argument, the argument gets its default value.Default Arguments: Python has a different way of representing syntax and default values for function arguments. Default values indicate that the function argum 7 min read Function Annotations in Python Basic Terminology PEP: PEP stands for Python Enhancement Proposal. It is a design document that describes new features for Python or its processes or environment. It also provides information to the python community. PEP is a primary mechanism for proposing major new features, for example - Python W 7 min read Assign Function to a Variable in Python In Python, functions are first-class objects, meaning they can be assigned to variables, passed as arguments and returned from other functions. Assigning a function to a variable enables function calls using the variable name, enhancing reusability.Example:Python# defining a function def a(): print( 3 min read How to bind arguments to given values in Python functions? In Python, binding arguments to specific values can be a powerful tool, allowing you to set default values for function parameters, create specialized versions of functions, or partially apply a function to a set of arguments. This technique is commonly known as "partial function application" and ca 3 min read How to call a function in Python Python is an object-oriented language and it uses functions to reduce the repetition of the code. In this article, we will get to know what are parts, How to Create processes, and how to call them.In Python, there is a reserved keyword "def" which we use to define a function in Python, and after "de 5 min read Like