PythonStatements
Statements
Acomputer program is a list of "instructions" to be "executed" by a computer.
In a programming language, these programming instructions are calledstatements.
The following statement prints the text "Python is fun!" to the screen:
In Python, a statement usually ends when the line ends. You donot need to use a semicolon (;) like in many other programming languages (for example,Java orC).
Many Statements
Most Python programs contain many statements.
The statements are executed one by one, in the same order as they are written:
Example
print("Have a good day.")
print("Learning Python is fun!")
Example explained
From the example above, we have three statements:
print("Hello World!")print("Have a good day.")print("Learning Python is fun!")
The first statement is executed first (print "Hello World!").
Then the second statement is executed (print "Have a good day.").
And at last, the third statement is executed (print "Learning Python is fun!").
Semicolons (Optional, Rarely Used)
Semicolons are optional in Python. You can write multiple statements on one line by separating them with; but this is rarely used because it makes it hard to read:
However, if you put two statements on the same line without a separator (newline or;), Python will give an error:
Best practice: Put each statement on its own line so your code is easy to understand.

