Python: Creating Source Code Files

♠ Posted by Unknown in at 23:30

Creating Source Code File in Python


Entering Python Statement at the statement prompt >>> is convenient, but the statements are not saved. To save statements for later use, you can create a python file to store the statements. The file can be created using editor, that file is called a Python source file or script file, or module. By convention, Python files are named with the extension .py.

Running a Python program from a script file is known as running Python in script mode. Typing a statement at the statement prompt >>> and executing it is called Python in  interactive mode.

To create new Python file in IDLE, select file menu à New File. It opens new file window type following lines and save it as “Example01.py”. Now Click Run (F5) from Run menu of window. Control transfer to IDLE statement prompt and show the output.



Example:

Example01.py

#Display two messages
print(“Welcome to world of Python…”)
print(“Hello Friends…”)


0 comments:

Post a Comment