Comas and Concatenation: strings and numbers

Hi, on the “hello world” lesson on concatenation (link below) it shows that you can use coma instead of + if you also include a number.
example:
birthday_string = “I am "
age = 10
birthday_string_2 = " years old today!”
print(birthday_string, age, birthday_string_2)

will print: I am 10 years old today!

I’ve tried comas only with strings and the comas and quotation marks remained.
example:
string1 = "The wind, "

string2 = "which had hitherto carried us along with amazing rapidity, "
string3 = "sank at sunset to a light breeze; "
string4 = "the soft air just ruffled the water and "
string5 = "caused a pleasant motion among the trees as we approached the shore, "
string6 = “from which it wafted the most delightful scent of flowers and hay.”

message = string1, string2, string3, string4, string5, string6
print(message)

Will print: ('The wind, ', 'which had hitherto carried us along with amazing rapidity, ', 'sank at sunset to a light breeze; ', 'the soft air just ruffled the water and ', 'caused a pleasant motion among the trees as we approached the shore, ', ‘from which it wafted the most delightful scent of flowers and hay.’)

I’ve tried adding a number variable to the mix but the printing issues stays the same.

can someone plz explain what is going on?

link to lesson: https://www.codecademy.com/paths/computer-science/tracks/cspath-cs-101/modules/cspath-python-hello-world/lessons/python-hello-world/exercises/concatenation

tnx!

I just wrote a reply to a similar question that might cover your query-

If not then by all means say so :slightly_smiling_face:.

1 Like

Yes, the + concatenates the strings.

You can also include a number by changing it to a string and using +.

statement = "My age is"
age = 31
print( statement + " " + str(age) )
#// or do this using:
print( statement, age)

In a lesson later on, you’ll learn about using .join for this too.

str1 = "I am"
str2 = "not"
str3 = "a crook"
str_list = [str1, str2, str3]
joined_with_a_space = " ".join(str_list)
print(joined_with_a_space)

thank you!
looking into tuple and printing multiple arguments vs concatenation made it clear.