0
Why is that a syntax error?
>>> print("ist kleiner als") ist kleiner als >>> x=1 >>> y=2 >>> print(x "ist kleiner als" y) SyntaxError: invalid syntax
9 Antworten
+ 1
You need to use comma for concatenation.
+ 3
you have to do
print(x, "ist kleiner als" , y)
or something like
print(x + " ist kleiner als " + y)
Comma(,) will leave a space but plus(+) will not. You can use either.
+ 1
wait Akib Reza only plus is used for concatenation right? not comma? or did i mess up?
+ 1
Thanks
I think that wil be teached later in the course
I tried to do some excercise and this error was very annoying
+ 1
Michael Jedtke welcome. It is taught in module 1 lesson 8.
+ 1
S. C. oh, i don't know the correct term for this operation. Sorry.
+ 1
same
+ 1
hmmm..
0
I just know it for some reason. String concatenation uses plus sign in python.
JS uses plus sign for mentioned problem and also concatenation i think.