# Introduction to Python – Script Mode

In this Page, We are Providing Introduction to Python – Script Mode. Students can visit for more Detail and Explanation of Python Handwritten Notes Pdf.

## Introduction to Python – Script Mode

Script mode

If the Python interpreter is closed and then invoked again, the definitions that were made (functions, variables, etc.) are lost. Therefore, to write a long program, the programmer should use a text editor to prepare the input for the interpreter and run it with that file as input instead. This is known as creating a “script”. Most of the examples in this book are discussed using interactive mode, but few scripts are also incorporated.

First program

This section will demonstrate to write a simple Python program, which prints “Hello World”. Type the following lines in an IDLE text editor and save it as “HelloWorld.py”.

#! /usr/bin/env python
print('Hello world')

The first line is called “shebang line” or “hashbang line” (more information in the next section). The second line gives the output: “Hello World”. There are numerous ways to run a Python program. The simplest approach is to press the F5 functional key after saving the program in an IDLE text editor. The output is shown below:

>>>
Hello world