A program code contains two types of lines, such as a physical line and a logical line. At the same time, the physical line is what we see while writing the program. The logical line, on the other hand, is what we see as a single statement.
For example, print(“welcome”) is a logical line. If a line contains only this statement, it also corresponds to a physical line. In python, we can assume that each physical line corresponds to a logical line. So, for a good programming habit, you have to specify a single statement on a line. This also makes the code readable and easily understandable.
But when we want to specify more than one statement in a single line, then you should use a semicolon (;) to separate the two statements.
Now we are giving examples where all the statements given below are equivalent.
Multiple statements on a single line example
msg="In single line"; print(msg)
In single line
Leave a comment