Spaces in Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

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?

21st Mar 2020, 4:41 PM
Fran
Fran - avatar
2 Answers
+ 8
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.
21st Mar 2020, 4:52 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
It is easier to read. Keep it simple Keep it stupid
22nd Mar 2020, 6:27 AM
Bakhromjon Olimkhujaev
Bakhromjon Olimkhujaev - avatar