+ 1
Print problem
Why should we put spaces like this: Print(“Knowledge “ + “is “ +”power”) If we wanna show Knowledge is power. Can’t we just do it without spaces?
3 ответов
+ 1
Hello,
If you do it without spaces, you will get:
**Knowledgeispower** .
This is the reason why you add space, at the end of each sting.
This is just shown for the purpose of string concatenation (combining two strings together), but it's quite useful.
However, you can do it alternatively:
print("Knowledge is power")
OR:
print("Knowledge", "is", "power")
Notice that we don't put spaces at the end of the string. This is because comma (,) automatically makes spaces, and allows to combine different data types into one output of the print() function, such as strings and integer, e.g.
print("Armin is", 20, "years old")
+ 1
Ohhh I get it now, thanks sm
+ 1
Use a comma instead of "+"