📖 generic · 12th TN - English Medium · COMPUTER SCIENCE · Page 53question

PYTHON – VARIABLES AND OPERATORS

Chapter 2: 3 · COMPUTER SCIENCE

PYTHON – VARIABLES AND OPERATORS 12th Computer Chapter - - The version .x of Python IDLE ( I ntegrated D evelopment L earning E nvironment) is used to develop and run Python code. It can be downloaded from the web resource Programming in Python . In Python, programs can be written in two ways namely Interactive mode and Script mode. The Interactive mode allows us to write codes in Python command prompt (>>>) whereas in script mode programs can be written and stored as separate file with the extension .py and executed.

Script mode is used to create and edit python source file. . . Interactive mode Programming In interactive mode Python code can be directly typed and the interpreter displays the result(s) immediately.

The interactive mode can also be used as a simple calculator. (i) Invoking Python IDLE The following command can be used to invoke Python IDLE from Window OS. Start → All Programs → Python .x → IDLE (Python .x) (Or) Click python Icon on the Desktop if available. Now Python IDLE window appears as shown in the Figure .

Menu Bar Tilte Bar Python prompt (>>>) Python IDLE Window The prompt (>>>) indicates that Interpreter is ready to accept instructions. Therefore, the prompt on screen means IDLE is working in interactive mode. Now let us try as a simple calculator by using a simple mathematical expressions. 12th Computer Chapter - - Python – Variables and Operators >>> + >>> + * >>> ** Example : >>>print ( “ Python Programming Language”) Python Programming Language >>>x= >>>y= >>>z=x + y >>>print (“The Sum”, z) The Sum = Example : Python Interactive Window .

. Script mode Programming Basically, a script is a text file containing the Python statements. Python Scripts are reusable code. Once the script is created, it can be executed again and again without retyping.

The Scripts are editable. (i) Creating Scripts in Python . Choose File → New File or press Ctrl + N in Python shell

Related topics

Have a question about this topic?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →