I would like to conditionally print
a statement as such:
be_nice = True
print("Hello")
print("Good to see you!") if be_nice else pass
However, it seems that using pass
here isn't allowed.
I found two ways to work around this, I can either do:
print("Good to see you!") if be_nice else 1
which seems to work since the 1
here simply does nothing, but is ugly. Or I can:
if be_nice: print("Good to see you!")
but this defeats the purpose of having the print
's align with each other.
Is there a way to use a single line solution which has the print
called at the start of the line?