A dictionary in Python is a collection of data which is unordered and mutable. Unlike, numeric indices used by lists, a dictionary uses the key as an index for a specific value. It can be used to store unrelated data types but data that is related as a real-world entity. The keys themselves are employed for using a specific value.
Refer to the below article to get the idea about Python Dictionary.
Passing Dictionary as an argument
In Python, everything is an object, so the dictionary can be passed as an argument to a function like other variables are passed.
key: b Value: 2 key: a Value: 1 key: c Value: 3
Passing Dictionary as kwargs
kwargs” stands for keyword arguments. It is used for passing advanced data objects like dictionaries to a function because in such functions one doesn’t have a clue about the number of arguments, hence data passed is be dealt properly by adding “**” to the passing type.
John F. Kennedy
John F. Kennedy x = 2 y = 0
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python | Passing dictionary as keyword arguments
- Tuple as function arguments in Python
- Python - pass multiple arguments to map function
- How to find the number of arguments in a Python function?
- Passing function as an argument in Python
- How to pass multiple arguments to function ?
- Packing and Unpacking Arguments in Python
- Python | Set 6 (Command Line and Variable Arguments)
- Executing functions with multiple arguments at a terminal in Python
- How to handle invalid arguments with argparse in Python?
- Unpacking arguments in Python
- Default arguments in Python
- Deep dive into Parameters and Arguments in Python
- Command Line Arguments in Python
- Python | Passing Filenames to Extension in C
- Python | Convert flattened dictionary into nested dictionary
- Python | Convert nested dictionary into flattened dictionary
- Python | Convert string dictionary to dictionary
- Python | Pretty Print a dictionary with dictionary value
- Regular Dictionary vs Ordered Dictionary in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.