In the previous article, you learned about installing python 3.x on your windows computer. After installing python you can start writing programs in python language. In this article, you will learn about interactive mode to write programs.
The python programming has two different mode to write programs. They are:
- Interactive Mode
- Script Mode
Python Interactive Mode
Python 3.x is a interpretive language. It means whatever line of code you write will be interpreted immediately. The output of the code is immediately visible.
You can go to start > All Programs > Python 3.x > IDLE. Now open the IDLE which include both
interactive mode and
The IDLE starts with an interactive mode where you can type your python codes.
The IDLE will immediately interpret your python code and display the results or otherwise an error. In the examples below, when you enter 5 + 11, the python computes it like a calculator and display the result 16.
You can declare a variable and assign a value 34. When you type the variable name on the IDLE it will return the value of that variable.
Lastly, python supports inbuilt functions such as type() to check the data type of a variable. In this case, name is a string type.
If you observe, there is one drawback of this type of programming. You cannot execute multiple lines of code at the same time.
The python allows you to run codes using a script with the help of scripting mode.
We will discuss about the scripting mode in next article.