Ctrc python

560 views
343 views

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
560
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ctrc python

  1. 1. Sujit Shakya Python
  2. 2. Programming Language? Language is a tool to perform certain task. Categories: Compiled language & Interpreted/Scripting Language C, C++ are the example of Compiled Language. PHP, Perl are the example of Scripting Language
  3. 3. What is Python? Compiled Language or Scripting Language?
  4. 4. What is Python? Compiled Language or Scripting Language? Python was developed by Guido van Rossum in the late 1980s. It is an Object Oriented High Level Language. Python is a scripting language, but in principle, it is first compiled and then interpreted.
  5. 5. Guido Van Rossum
  6. 6. Why Python? print “hello” #display hello in the screen include<stdio.h> include<conio.h> void main() { printf(“Hello World”); /*display hello in the screen*/ getch(); } Python focuses on user readability and simplicity
  7. 7. pi = 3.14 for r in range(4): area = pi * r*r print r, area print “End of Program” Python is dynamic in nature. #include<stdio.h> #include<conio.h> void main(){ float pi = 3.14; int r; float area = 0; for(r=0; r<5; r++){ area = pi * r*r; printf(“%d %f”, r, area); } printf(“End of Program”); } Why Python?
  8. 8. Why Python?  Beautiful is better than ugly.  Explicit is better than implicit.  Simple is better than complex.  Complex is better than complicated.  Readability counts. Lots of documentation and resources are available in internet for FREE !!
  9. 9. Why not Python?  Its dynamic nature costs more memory usage.  Its execution is slower than other compiled language like C and java.
  10. 10. Who uses Python?
  11. 11. Who uses Python?
  12. 12. Who uses Python?
  13. 13. Who uses Python?
  14. 14. How to use Python? Installation Download python 2.7 interpreter from http://www.python.org/download/ and install it.
  15. 15. How to use Python? Installation Download python 2.7 interpreter from http://www.python.org/download/ and install it. Getting Started Open python shell from start menu. Open the new window from file menu, write some python code and press F5. Or, simply type your python code and press enter.
  16. 16. How to use Python? Basic Syntax #print something on screen print “something”
  17. 17. How to use Python? Basic Syntax #print something on screen print “something” #if condition if some_condition_1: statements 1 elif some_condition_2: statement 2 else: statement 3
  18. 18. How to use Python? Basic Syntax #for loop for count in range(10): do something for 10 times starting from 0-9
  19. 19. How to use Python? Basic Syntax #for loop for count in range(10): do something for 10 times starting from 0-9 #while loop i=0 while i<5: print “hello”, i i+=1
  20. 20. How to use Python? Basic Syntax #list num_list = [0,1,2,3,4,5] print num_list[0] #prints 0 print num_list[9] #Error: index out of range
  21. 21. How to use Python? Basic Syntax #list num_list = [0,1,2,3,4,5] print num_list[0] #prints 0 print num_list[9] #Error: index out of range #exception handling try: print num_list[9] except: print “Oops something went wrong”
  22. 22. How to use Python? Basic Syntax #function def sample_function: „‟‟some code written here. Where triple quote is a multiple line comment and also a documentation for your function‟‟‟
  23. 23. GUI application using Python. Python has a huge number of GUI framework (or toolkit). Some of them are:1. Tkinter 2. PyQt 3. PyGTK 4. PyUI and many more…………
  24. 24. Web Application using Python. Python has a huge number of web framework. Some of them are: 1. Django Web Framework 2. Cherry Py 3. Web2py 4. Zope2 and many more…………
  25. 25. Thank You!!!!

×