What kind error in concatenation program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What kind error in concatenation program

it showing syntax error...

3rd Jul 2018, 12:32 AM
Bouvthika RM
Bouvthika RM - avatar
2 Answers
+ 7
Based on your code: https://code.sololearn.com/cxAD4v956i89/?ref=app >>>print("First string" + ", " + "second string") First String,Second String >>>"spam"+"eggs" ">>>" is the immediate-mode "prompt". It means you are running Python interactively, and it is "prompting" you to type something, which it will evaluate immediately. At that prompt, you do _not_ need to use print() because -- when a statement returns a value -- the interpreter assumes you intend (want) to print things you put there. In scripts....like CodePlayground codes...you DO need to specify print(). print("First string" + ", " + "second string") ...Prints: First string, second string "spam"+"eggs" ...Works in immediate mode, but for scripts use: print("spam" + "eggs")
3rd Jul 2018, 1:41 AM
Kirk Schafer
Kirk Schafer - avatar
+ 1
Calling mod to edit your post. Please use tags for search purposes and place question in post body. You meant: >>>print("firststring" + "," + "second string")first string,sec[...] It should be: >>>print("1st string" + "," + " 2nd string") I don't know what you're trying to do after that.
3rd Jul 2018, 12:43 AM
non