🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Python Notes
Topic #5

Statements


Statements

A computer program is a list of "instructions" to be "executed" by a computer.

In a programming language, these programming instructions are called statements.

The following statement prints the text "Python is fun!" to the screen:

Example

print("Python is fun!")

In Python, a statement usually ends when the line ends. You do not need to use a semicolon (;) like in many other programming languages (for example, Java or C).


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("Hello World!")
print("Have a good day.")
print("Learning Python is fun!")

Example explained

From the example above, we have three statements:

  1. print("Hello World!")
  2. print("Have a good day.")
  3. 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:

Example

print("Hello"); print("How are
    you?"); print("Bye bye!")

However, if you put two statements on the same line without a separator (newline or ;), Python will give an error:

Example

print("Python is fun!") print("Really!")

Note: Best practice: Put each statement on its own line so your code is easy to understand.

Want to go beyond the notes?

Join CodingNow 2.0's Python course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Statements – FAQs

Quick answers about learning Statements in Python.

This free note from CodingNow 2.0 explains Statements in Python — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Python topic on CodingNow 2.0, including Statements, is 100% free with no signup required.
With focused practice, most students grasp Statements in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now