Help with default value of a function paramater

Hi All,

I do not understand why calling out the function destination_setup gives me NameError.
It says that mode_of_transport is not defined but shouldn’t it print ‘Car’ as the parameter has the defined value ‘Car’

Thanks for helping.

Hi,
The default parameter is taken when you call it without a valid argument;
e.g had your line 19 been;
destination_setup( “Siegburg”, “Cologne”, estimate)
it would have worked as, I presume, you expected.

As you’ve written it, it is expecting the mode_of_transport on line 19 to have a value.

Hi,

ok got it.

Only when I want to have a different value as the pre-defined one I had to write a value.

Thank you very much.