FAQ: Learn Python: Syntax - Review

The use of commas is not concatenation in Python, what you’re doing is creating a tuple (in other circumstances the comma is also used to separate arguments for a call and similar). If you want to concatenate, use +.

If I had to guess the potential confusion comes from the fact the print function can take multiple arguments, e.g. print("red", "orange", "yellow") which it prints with a space between. This is different to concatenation that makes one big string and then prints it print("red" + "orange" + "yellow").

Thank you for your response. Your second explanation makes sense. I confused print function arguments, with plain string concatenation.

this is how i did mine:

my_age = 18

half_my_age = my_age//2

half_my_age_2 = " and my brother is " +str(half_my_age)

greeting = “hey guys my name is”

name = " joel"

greeting_with_name = greeting+name

age_2 = " and I am "

age_3 = " years old"

age_full = age_2+str(my_age)+age_3

finished = greeting_with_name+age_full+half_my_age_2

print(finished)

This taks is pretty pointless because the final greeting_with_name doesn’t return a complete sentence.

In real-life coding, there is no one stopping you from using as much print statements as you like, specifically for debugging. However, this can easily cluster the coding environment, rendering readability difficult, which serves the opposite purpose of debugging in the first place.

So, make sure to only print sections of your code (input, intermediate results, output etc.) that is only related to the error (i.e, code which is deemed useful in solving the error). Also, within the context of this exercise, the number of print statements might be limited as the CC checker is quite strict in comparing user’s solutions with the expected result.

So i just got it done with this:

my_age = 26

half_my_age = 26 / 2

greeting = "hi "

name = " my name is Dillon "

age = " I am "

age1 = " ,half my age is "

greeting_with_name = (greeting+name+age + str(my_age) + age1 + str(half_my_age))

print(greeting_with_name)