Ex01 Print Command

Hello,

I’m going through LP3THW (using Windows/PowerShell) and I noticed that regarding the print command, I can either have a space or no space between the word print and the opening parentheses, and either way, it works just fine.

print (“Hello”)

print(“Hello”)

But I want to know if one is preferred over the other in the general community. Maybe both ways work fine in Windows, but only one way works if it’s run on Linux. Or maybe one way is considered good form for readability or something like that.

Anyway, is there one method I should stick to, or does it not matter?

Hi, generally you do this:

print("hi")

Python doesn’t actually care but other programmers do. Adding the space makes it more difficult to read what that is.

2 Likes