Python Shorthandf If
If Statement in One Line
If you have only one statement to execute, you can put it on the same line as the if statement.
ExampleGet your own Python Server
One line if statement:
if a > b: print("a is greater than b")
Try it Yourself »