What is Python Variable, Expression and Statement

What is a variable in Python ?

It is a place where we can store values. Instead of using the values directly, we can refer the variable name where the actual values are stored.

Example
> x = 2 === > here X is Variable
> name = 'John' === > here NAME is variable



What is an Expression in Python ?

It contains values, variables and operators.

Example
> 10
> x
> y = x + 10



What is a Statement in Python ?

It is a logical unit of code that can be executed at the Python interpreter. When we type statement at the command promt, it will execute the code in the statement then provides the results, as long as the code is clean. We can execute code that is in a file. In general these file contains scripts, these scripts are combination of statements to perform units of work.

Example
> print("Hello World")
Hello World


Python Interview Questions and Answers - INDEX


What are the differences between Python 2.x vs Python 3.x (2.7 vs 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9), when to you which version ?


What is Python Variable, Expression and Statement ?


What is a 'Reserved Word' in Python ? List of Reserved words in Python ?