Page 236 - CTS - CSA TP - Volume 2
P. 236

COMPUTER SOFTWARE APPLICATION - CITS




           EXERCISE 121 : Use Command Line and IDE to create

                                        and execute a python program

            Objectives

           At the end of this exercise you shall be able to
           •  develop simple python programs and execute it in Commandline/IDE.
           Requirements


           Tools/Materials
           •  PC/Laptop  with Windows OS
           •  Latest Version of Python


           Procedure

           Write and Run a Simple Python Program

              1  Create a Python File:
                •  Use a text editor or your chosen code editor to create a file with a .py extension (e.g., hello.py).
              2  Write a Simple Python Program:
                •  Open the file and write a simple Python program, for example:


















           Run the Program:
           Method 1: Usingcommand prompt or terminal
              •  Save the file and return to the command prompt or terminal.
              •  Navigate to the directory where your Python file is located.

              •  Run the Python script with:






















                                                           221
 CITS : IT & ITES - Computer Software Application - Exercise 120
   231   232   233   234   235   236   237   238   239   240   241