An expression is a combination of values,
variables, and operators.
Eg:
17
x
x + 17
Instructions
that a Python interpreter can execute are called statements. A statement is a unit of code that the
Python interpreter can execute. Two kinds of statement: print and assignment.
Eg:
a = 1 + 2
+ 3 + \
4 + 5 + 6
+ \
7 + 8 + 9
In
Python, end of a statement is marked by a newline character. But we can make a
statement extend over multiple lines with the line continuation character (\).
Most of
the programming languages like C, C++, Java use braces { } to define a block of
code. Python uses indentation.
A code
block (body of a function, loop etc.) starts with indentation and ends with the
first unindented line. The amount of indentation is up to you, but it must be
consistent throughout that block.
Generally
four whitespaces are used for indentation and is preferred over tabs. Here is
an example.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.