Statements & Comments:-

Statements:-
In computer programming a statement can be thought of as the smallest standalone element of an imperative programming language. A program is formed by a sequence of one or more statements. A statement will have internal components.
Multi Line statements:-
Statements in Python typically end with a new line.But we can make a statement extend over multiple lines with the line continuation character ().As shown here:-

sum = num1 + num2 + \
num3 + num4 + \
num5

If the statements is within the {},[],() brackets so there is no need to use line continuation.As shown here:-

number = {'one', 'two', 'three',
'four', 'five', 'six',
'seven'}


We can also put multiple statements in a single line using semicolons, as shown here:-

a = 1; b=2; c=3

Quotation in Python:-
Python accepts single (‘), double (“) and triple (”’ or “””‘) quotes to denote string.Same type of quote should start and end the string.As shown here:-

word = 'word'
sentence = "This is a sentence."
paragraph = """This is a paragraph.
It is made up of multiple lines and sentences."""

How to put Comments:-
A hash sign (#) is used to put the comments.After hash sign the written statements  would be treated as a comment and the Python interpreter ignores them.As:-

# This is comment
name =  "Myprogworld"   # this is also a comment

 

Leave a comment