Len's Slice - printing string

I’m currently doing the Len’s Slice project, and noticed something during the “print the string” step.

print('We sell', num_pizzas ,'different kinds of pizza!')
print("We sell " + str(num_pizzas) + " different kinds of pizza!")

I can see that these two lines of code yield the same result:

We sell 7 different kinds of pizza!

What’s the difference between the first and the second print codes?

the first we use commas to print multiple things, the second you do string concatenation (the string is joined into a single string)

1 Like

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.