0

How to properly add space in printed statements

I get WelcomeAmy instead of Welcome Amy

7th Jan 2021, 4:10 AM
Daniel Johnson
Daniel Johnson - avatar
3 Answers
+ 4
When separated by commas, the parameter "sep" is whitespace by default print("Welcome", "Amy") >> Welcome Amy - - - - - - - - - - - - - - Note that here, there is a whitespace after the word Welcome, because concatenating strings don't add whitespaces in between. print("Welcome " + "Amy") >> Welcome Amy
7th Jan 2021, 4:12 AM
noteve
noteve - avatar
+ 3
print takes arguments of the string to be outputed like: print("Welcome","Amy") this will result in "Welcome Amy" if you do "Welcome"+"Amy" it would result in "WelcomeAmy"
7th Jan 2021, 4:12 AM
CutieRei
CutieRei - avatar
+ 1
Thank you all. The way I worded the question wasn't quite correct but useful nonetheless. ("Welcome", name) gave the correct output.
7th Jan 2021, 4:19 AM
Daniel Johnson
Daniel Johnson - avatar