Outdated lesson text?

In section 7 the following statement appears “When a function has a default value for one of its parameters, we can no longer call it positionally, and only by keyword.”

I can’t replicate the above statement. If a function has a default value and I call it using a positional argument it works fine. Am I misunderstanding what the above quote is trying to explain?

4 Likes

It could be that if you define a specific phrase, in this case the function was defined as saying "Engrossing Grocer’s " it will automatically call that phrase no matter what, so you don’t need to use a positional argument for it. Whereas, with the special item it didn’t have a specific phrase, so it would need to be called and a phrase or keyword would need to be introduced. I hope this helps.

1 Like

Yea I’m still stuck on that statement in part 7 “When a function has a default value for one of its parameters, we can no longer call it positionally, and only by keyword.”

I intended to break it to check this, and I’m able to pass arguments positionally that have default values and receive the correct output

Example from the lesson:

Define create_spreadsheet():

def create_spreadsheet(title, row_count = 1000):
print(“Creating a speadsheet called " + title + " with " + str(row_count) + " rows”)

Call create_spreadsheet() below with the required arguments:

create_spreadsheet(“Downloads”)
create_spreadsheet(“Applications”, 10) #<----- notice here that I did not explicitly call row_count.

What do you mean by a “special item” ? The sentence which emommsen was referring to, still seems to be wrong. Calling a function positionally works absolutely fine, even though it has a default parameter (which accepts any other argument anyway).