0
Python concatenation question
Brand new to coding, 3 days in and noticed that printing strings without a + or , will result in the same output (except for the space placed by ,) Is it just good practice to throw a concatenation in there to make it easier to read and is it ok to omit them completely? Example: print(“python” + “question”) print(“python” “question”) Both output pythonquestion
2 Respostas
+ 2
I tried it with some code, the one that is commented out isn't working.
x = "python" + str(5) + "question"
print("python" + str(5) + "question")
#print("python" str(5) "question")
print(x)
y = "python" "question"
print(y)
And there is something like good practice. I use the +.
+ 1
Thank You, someone on reddit called it an implicit concatenation and it only with string literals. Variables return and error. So kind of only works with very basic code