Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Python programming lab2

292 views

Published on

creating .py program for python

Published in: Education
  • Be the first to comment

  • Be the first to like this

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

×