Home | | Problem Solving and Python Programming | Statements and Expressions - Python

Chapter: Problem Solving and Python Programming : Data, Expressions, Statements

| Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail |

Statements and Expressions - Python

Instructions that a Python interpreter can executes are called statements.

STATEMENTS AND EXPRESSIONS:

 

Statements:

-Instructions that a Python interpreter can executes are called statements.

-A statement is a unit of code like creating a variable or displaying a value.

>>> n = 17

>>> print(n)

Here, The first line is an assignment statement that gives a value to n.

The second line is a print statement that displays the value of n.

 

Expressions:

-An expression is a combination of values, variables, and operators.

-A value all by itself is considered an expression, and also a variable.

So the following are all legal expressions:

>>>  42

42

>>>  a=2

>>>  a+3+2

7

>>>  z=("hi"+"friend")

>>>  print(z)

Hifriend

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail


Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.