Keyword arguments


#1

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


#2

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

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


#3

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

this is way better than code academy at explaining things


#4

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.