Python has a command line environment also called as REPL.REPL means read,evalutate,print and loop.You enter a command which Python interpreter evaluates and then prints the results of evaluation.Then it waits for another command.
You can start REPL by just typing “Python” at the run window
When we start REPL it prints the version of Python.
Python REPL is a interactive session.You enter commands and they are executed one at a time.For example you can type the following to print a simple message:
print() is one of the functions in Python 3.
Below we are setting variables x ,y and assigning z the sum of x and y.We are then printing the value of z.
In the following example we are printing the values of variables of for loop.
python uses indentation instead of curly braces unlike c# or java.So after the for loop we give for whitespaces before writing the print() function.
for i in range(5) (4 spaces are used instead of braces) print(i)
whitespaces are significant in python and also makes Python code easier to read.Four spaces is a convention in Python.So if different lines of your code are at the same level of indentation then they are considered part of same code block.
For example if you write the following code then you will get error: