Marcos DuranPython Development Techdegree Student 1,930 Points
Bringing together strings and variables with '+' vs ','
I have a question about putting together strings and variables using operands and commas.
In the previous quiz the output was correct using:
print("* ", continent) which outputed "* Asia" but the quiz did not accept.
print("* " + continent) which outputed the same thing and was accepted.
At a deeper level what are the differences or limitations between these two?
They both have different nature and they are not the same the comma makes it a
tuple and + operand just concatenates it.
name = "Marcos" a = "* " , name b = "* " + name print(a) print(b) print(len(a)) print(len(b))
also try this
a will be stored as a tuple and the
b will be more like a single string.