Created
January 23, 2018 08:12
-
-
Save menon92/0024d5600080cea805b10be538f242dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using *args | |
args = ("Hello", 1, 2, 3) # set the argument list | |
variable_lenghts_argument_function(*args) # call the function with the argument | |
Output: | |
Normal argument is: Hello | |
Argument pass by *argv is: 1 | |
Argument pass by *argv is: 2 | |
Argument pass by *argv is: 3 | |
# using **kwargs | |
kwargs = {"name" : "Arif", "age" : 21, "department" : "CSE"} # set argument. | |
test_kwargs_argument(**kwargs) # call the function with the argument. | |
Output: | |
Argument pass by **kwargs is: age = 21 | |
Argument pass by **kwargs is: department = CSE | |
Argument pass by **kwargs is: name = Arif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment