Sunday, 5 March 2017

How to Develop Python Applications/Programs

Development of Python programs or applications:

Python applications can be developed in two modes 
  • Interactive Mode
  • Batch Mode

1)Interactive Mode:-
  • Submitting one by one Python statement to the Python interpreter by the programmer explicitly is known as a interactive mode. 
  • In-order to develop the Python programs in interactive mode we have to open the Python interpreter. 
  • We can open the Python interpreter by running Python command on the command prompt.

                          D:\> python
                               >>>2+4          >>> this symbol shows the python interpreter environment
                               6

                              >>> "Hello World!"
                               'Hello World!'

                              >>>x=10
                              >>>y=20
                             >>>x+y
                                30
                            >>>quit()  (or) we are using ctrl+z to exit from the python interpreter
                             D:\>




  • Interactive mode is suitable for learning the python but it is not suitable for developing the projects or applications because whenever we exit from python interpreter the work which is done previously is going to be loss.

2)Batch Mode:-
  • Writing the group of statements in a file, saving that file with the extension of .py and submitting that file to  the python interpreter at a time is known as a batch mode.
  • In-order to develop the python programs in batch mode we use Editors or IDE's. 
  • The various Editors are:
  1. Notepad                          
  2. Notepad++
  3. EditPlus
  4. gedit
  5. vi
  6. vim
  7. kedit
  8. kwrite
  9. nano  etc.....,

  • Different IDE's are:

  1. Pycharm
  2. Eric
  3. wing
  4. NetBeans
  5. Eclipse 
  6. Komodo
  7. Pydev
  8. Ninja
  9. Pida
  10. Pyscripter
  11. sublime       etc....,

  • Open notepad and save the test.py


                                           x=100
                                           y=20
                                           print(x+y)
                                           print(x-y)
                                           print(x*y)
                                           print(x/y)
  • Goto command prompt

                                        D:\>python test.py
                                                   120
                                                     80
                                                  2000
                                                        5


  • If we develop the Python applications by using Editors then development time,cost will be increased, automatic debugging is not possible and we cannot able to use the version controlling tools.
  • To overcome the above problems we use the IDE's for the development of Python applications or Projects.
After Downloading and installing the PyCharm IDE,

  • Open the PyCharm IDE, by clicking the shortcut icon 


  • Click on File menu

  • Click on New-Project and selecting the Pure Python
  • Give the project name on location as demo.py(it is example) and click the Create button

  • After creating the project(demo.py), Right click on project(demo.py)
  • Click on New
  • Click on Python file

  • Give the File Name as demo or demo.py
  • Click on OK button

  • Writing the python code

  • After writing the python code
  • Click on Run Menu
  • Click on Run


  • Click on Demo(filename) or selecting the Demo(filename)



Note:
  • Python software by default automatically install IDLE.
  • IDLE is not a IDE, it is a Editor.
  • When ever we install the python software on windows operating system by default we will get one editor called IDLE.
  • With in the IDLE we can develop python applications/programs in Interactive mode and Batch mode

  • Goto Start menu 
  • Click on All Programs
  • Click on Python35 folder
  • After click on IDLE(Python3.5 64-bit/32 bit)
  • Click on File menu
  • Click on New-File
  • Writing the Python Code


  • After writing the python code
  • Click on File Menu
  • Click on Save

  • After Save the file
  • Click on Run Menu
  • Click on Run  module
  • Finally output will be show








No comments:

Post a Comment