From the course: Python: Decorators

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Functions with *args and **kwargs

Functions with *args and **kwargs - Python Tutorial

From the course: Python: Decorators

Start my 1-month free trial

Functions with *args and **kwargs

- [Instructor] You've probably already come across functions with single star, normally star-args and double star arguments, normally double star kwargs or double star keyword arguments. So why do you need them? If you want to pass multiple arguments or keyword arguments to a function, then single star arguments and double star keyword arguments are your go to. Now let's say I want to print out the numbers of the Fibonacci Sequence and I'd use them as input arguments. So let's head over to the Repl. So now that I'm in the Python Repl, I'm going to call this function pfib and just you don't confuse it with print fib that we used earlier in the course. So let's define pfib. So define pfib as A, B and C and we want to print out these three arguments. Now what I'm going to provide are the first three numbers of the Fibonacci sequence. So one, one and two and we should be able to see these three arguments printed out.…

Contents