[SOLVED]Magic letter bug | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

[SOLVED]Magic letter bug

this code is supposed to output "letter/s". but whenever I call up more then one letter. it adds a space to the first line. why? can someone explain? https://code.sololearn.com/cFPFjvwDsXPr/?ref=app

23rd May 2018, 6:18 PM
LONGTIE👔
LONGTIE👔 - avatar
5 Answers
+ 6
Nice code 😊👌 the thing is, in Python3, by default there's a space between multiple values printed. So what you can do is just add the "separator" argument to the print function and set it to an empty string, like this: print(a, b, c, sep="")
23rd May 2018, 6:49 PM
Pao
Pao - avatar
+ 2
format string?
23rd May 2018, 6:33 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 2
Ok thx Pao
23rd May 2018, 6:50 PM
LONGTIE👔
LONGTIE👔 - avatar
0
Python adds a space after each variable. You could use a format string to print how you want stuff printed
23rd May 2018, 6:32 PM
Max
Max - avatar
0
https://docs.python.org/3/tutorial/inputoutput.html#old-string-formatting
23rd May 2018, 6:34 PM
Max
Max - avatar