MezzanineLearner MezzanineLearner - 1 month ago 6
Python Question

What's the difference with Python statements ending with ;?

What's the difference with Python statements ending with ; and those does not?

Answer

There is really no difference. Python ends a line of code at the end of the logical line, or when it encounters ;

The only advantage to using ; is that you can stack multiple logical lines into one physical line. For example (in python3):

import sys

for i in range(10):
    print(i, end=' '); sys.stdout.flush()

That said, this is terrible coding style, so don't ever do it