O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Python programming lab2

295 visualizações

Publicada em

creating .py program for python

Publicada em: Educação
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

Python programming lab2

  1. 1. Python programming Lab Sequence 2 Prof B N Kshirsagar MIT Group , Aurangabad , MS, India
  2. 2. Hello World ! This is very simple and impressive !! I am interested in writing programs using python , now onwards. >>> print "Hello World !“ print "This is very simple and impressive !!“ print " I am interested in writing programs using python , now onwards." By using editor ,like VI , create “hello.py” To run this program, just type $python hello.py
  3. 3. sum.py x = 10 y = 20 z = x + y print z $ python sum.py 30 >>>
  4. 4. Examfees.py exam_fees = 10000 service_tax = exam_fees * 12.36 / 100 total_fees = exam_fees + service_tax print total_fees $python examfees.py 11236.0 >>>
  5. 5. To make executable .py program, just add top line #!/usr/bin/env python $chmod +x hello.py $./hello.py SETTING STANDARDS Hello World ! This is very simple and impressive !! I am interested in writing programs using python , now onwards. >>>
  6. 6. #!/usr/bin/env python print "Hello World !“ print "This is very simple and impressive !!“ print " I am interested in writing programs using python , now onwards." hello.py #!/usr/bin/env python x = 10 y = 20 z = x + y print z sum.py #!/usr/bin/env python exam_fees = 10000 service_tax = exam_fees * 12.36 / 100 total_fees = exam_fees + service_tax print total_fees examfees.py Final programs : .py
  7. 7. Thanks Contact Prof B N Kshirsagar MIT Group of Academic & Research Institutions, India www.mit.asia prof.bnk at gmail dot com

×