From the course: Transition from C# to Python

Unlock the full course today

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

Named and default parameters

Named and default parameters

From the course: Transition from C# to Python

Start my 1-month free trial

Named and default parameters

- [Instructor] In C# you can call functions with named parameters and defined functions that have parameters with default values. So if we look at our C# functions example, which we still have open here in our editor, we'll scroll down to the namedparams function, which takes an integer, a string, and then there's a Boolean parameter and the Boolean has a default value of false. So this function can then be called using the names of the parameters instead of the positional order in which they are declared, which can make the code easier to read. So if we scroll back up a little bit, you'll see that here I'm calling the function. Right here's namedparams. And here I'm calling it without any of the parameters as names. But here, right, I'm using each of the parameter names to assign values. And this makes the code a little bit more readable for some cases. So Python has the same features. So let's switch over to the…

Contents