Spaces in Python | Sololearn: Learn to code for FREE!


Spaces in Python

Is there a reason to put spaces in between calculations? for example 2+2 vs 2 + 2, because the output is the same. Besides that is there any rule for leaving a space?

3/21/2020 4:41:16 PM


3 Answers

New Answer


No, it's just a matter of personal preference. I personally like to leave a space between operators so it's easier to read and distinguish them from each other. Other than that, there is no difference.


It is easier to read. Keep it simple Keep it stupid


Fran pep8 has something to say about that... but let pep20 be your guide... OR >>>import this 😜👍