Keyword arguments

https://www.codecademy.com/courses/learn-python-3/lessons/intro-to-functions/exercises/keyword-arguments?action=resume_content_item

i dont understand any of this. why isnt def create_spreadsheet (title , "Creating a spreadsheet called " ) correct. I hit solution and i still dont understand it and the damned thing gave me a badge too which is frustrating I didn’t earn it

def create_spreadsheet(title):
title = (“Downloads”)
print("Creating a spreadsheet called ")

create_spreadsheet(“Downloads” + title) title is not defined?

https://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/functions.html

this is way better than code academy at explaining things

title is a parameter. Is there a particular reason for changing it inside the function?

The keyword argument is missing from your parameter list…

def create_spreadsheet(title, row_count=1000):

The print statement above is incomplete, as well…

print("Creating a spreadsheet called "+title+" with "+str(row_count)+" rows.")

When calling the function we would not include the parameter name in the argument, just the worksheet name.

create_spreadsheet("Downloads")

If we wish to supply a row count that differs from the default, we can include it in the argument list…

create_spreadsheet("Applications", 10)

If you happened to missed the unit on functions, then now would be a good time to step back and swing over to that track.

There are two advantages of keyword arguments

  1. Using the function is easier since we do not need to worry about the order of the arguments.
  2. We can give values to only those parameters which we want, provided that the other parameters have default argument values.