Functions, ex 7

Hi! I am new to Python and in this exercise we were req to call 10 as the second argument. I don’t understand why it need to be a string and not an integer.

My code:

Define create_spreadsheet():

def create_spreadsheet(title, row_count):

print(“Creating a spreadsheet called " +title+ ’ with ’ +row_count+ " rows”)

Call create_spreadsheet() below with the required arguments:

create_spreadsheet(“Applications”, 10)

Solution code:
def create_spreadsheet(title, row_count = 1000):

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


create_spreadsheet(“Applications”, 10)

Hello @narmeenzehra , welcome to the forums! The way string concatenation works is that you need to concatenate strings, so:

"string1" + 10

Doesn’t work (it throws an error), but:

"string1" + "10"

Works (the result is "string110").

1 Like