Python: About function arguments

Function arguments

Define function

Define a function that accepts and outputs arguments

def func(x, y, z):
    print(x, y, z)

Define two arguments in succession with tuple and dict

#tuple type
tuple_arg = (1, 0, 1)

#dict type
dict_arg = {'x': 1, 'y': 0, 'z': 1}

When I pass tuple as an argument of the function func

func(*tuple_arg)
>>> 1, 0, 1

When I pass dict to the argument of the function func

func(**dict_arg)
>>> 1, 0, 1

In both cases, it recognizes the argument and expands the value from the passed type.

Recommended Posts

About function arguments (python)
Python: About function arguments
python function ①
About the enumerate function (python)
python function ②
[Python] Function arguments * (star) and ** (double star)
About python slices
About python comprehension
python enumerate function
About Python tqdm.
About python yield
About python, class
Python> function> Closure
About python inheritance
About python, range ()
About python decorators
Python> function> Inner function
About python reference
About Python decorators
[Python] About multi-process
Python function decorator
About the arguments of the setup function of PyCaret
Combine python function arguments into one variable
About Python for loops
Summary about Python scraping
Automatically register function arguments to argparse in Python
[Python] Memo about functions
Summary about Python3 + OpenCV3
About Python, for ~ (range)
Python function argument summary
About Python3 character code
[Python] Memo about errors
Python print function (sequel)
About the Unfold function
Python, about exception handling
Time floor function (Python)
About Python Pyramid traversal
Summary of Python arguments
About Python3 ... (Ellipsis object)
[Python] Chapter 01-01 About Python (First Python)
[Python] About standard input
About __all__ in python
Execute Python function from Powershell (how to pass arguments)
About django custom filter arguments
About Fabric's support for Python 3
Create a function in Python
About python objects and classes
About Python variables and objects
[python] Value of function object (?)
About the Python module venv
ntile (decile) function in python
Think about architecture in python
[Python] Etymology of python function names
Receive runtime arguments in Python 2.7
About the ease of Python
About fork () function and execve () function
About Python, len () and randint ()
About Perl, Python, PHP, Ruby
About Python datetime and timezone
A memorandum about correlation [Python]
python url setting include function