Python 3.x Interactive Mode

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:

Advertisements
  1. Interactive Mode
  2. 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 script mode. The IDLE starts with an interactive mode where you can type your python codes.

Advertisements
Python 3.x IDLE has both interactive and script mode.
Figure 1 – Python 3.x IDLE has both interactive and script mode.

Executing 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.

Executing Python code in Interactive mode.
Figure 2 – Executing Python code in Interactive mode.

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.

Advertisements

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.