Skip to content

Instantly share code, notes, and snippets.

@menon92
Created January 23, 2018 08:12
Show Gist options
  • Save menon92/0024d5600080cea805b10be538f242dc to your computer and use it in GitHub Desktop.
Save menon92/0024d5600080cea805b10be538f242dc to your computer and use it in GitHub Desktop.
# 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