About strings


#1

Why should we use “strings” or “+” to add our statements when we can write a full sentence in the “print” ?


FAQ: Learn Python - Python Syntax - Strings
#2

Can you please give an example to clarify your question?


#3

I understand it is kind of rude to answer instead of him,but I think he is asking why someone would write
print “Hello” + “people” instead of “Hello people” (I answered because I was wondering the same thing,and didn’t want to create a new question since this is probably the same)


#4

its certainly not rude :wink: But sometimes i prefer to ask for clarification instead of guessing for the correct answer.

python has a built-in function named raw_input which we can use to prompt the user for input:

user_input = raw_input("enter something: ")

the result of the user input is stored in a variable named user_input, now if we want to display the user_input + a message we have to do:

print "you entered: " + user_input

this is just one of example, but sometimes we need to concatenate strings. Sometimes the lesson just tries to teach a concept without making it massively complicated.