Do we need to use `str()` on row_count?

I don’t quite understand why do we need to have the string command for the row_count below?

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

Because row_count is an integer and we cannot concatenate an integer (or a float) to a string. Using the str() constructor casts the number to a string type so it can be concatenated.

Is there a difference between using str() and passing it to print() as multiple arguments?

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

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

Is there a practical difference between the two?

Well, they both print what you want, but I think that keeping in mind that you are either printing strings (first example) or printing a tuple (second example) helps focus on what you are trying to do.

There is a host of string formatting machinery available to you if you’re interested in nice-looking output. On the other hand, printing tuples consisting of objects separated by commas is quick and easy, especially for developing and debugging.