Intro to Python CSSU Nov/28/2007 By Georgi Petrov & Atanas Dyulgerov
Outline <ul><li>What is Python </li></ul><ul><li>Python Advantages </li></ul><ul><li>Who uses Python </li></ul><ul><li>Syn...
What is Python? <ul><li>interpreted, interactive, object-oriented  programming language  </li></ul><ul><li>Widely used in ...
Python Advantages <ul><li>Elegant syntax </li></ul><ul><li>Safe </li></ul><ul><li>Object-oriented </li></ul><ul><li>Powerf...
Python is simple print &quot;Hello World!&quot; #include <iostream.h>  int main()  {  cout << &quot;Hello World!&quot;;  }...
Python is fun & practical <ul><li>Lack of type declaration </li></ul><ul><li>Huge library of modules </li></ul><ul><li>Wid...
Who uses Python <ul><li>Google </li></ul><ul><li>NASA </li></ul><ul><li>Rackspace </li></ul><ul><li>Industrial Light & Mag...
Syntax - Indentation
Syntax - Operators <ul><li>Comparison Operators ==,  <,  >,  <=,  >= </li></ul><ul><li>Logical Operators Zero values are t...
Data Structures <ul><li>Base Types integer, float, long integer, octal integer, hexadecimal integer, complex, character st...
Python Standard Library <ul><li>The greatest strengths of Python </li></ul><ul><li>Hundreds of modules </li></ul><ul><li>E...
Object Oriented Mechanism <ul><li>Similar to C++ and Java </li></ul><ul><li>Supports multiple inheritance </li></ul><ul><l...
Demo 1 <ul><li>Adjusting Apache to read Python </li></ul><ul><li>Sample “Hello World” script </li></ul>
Object Orientation <ul><li>Defining classes </li></ul><ul><ul><li>class SomeClass: </li></ul></ul><ul><ul><li>  &quot;Just...
Object Orientation <ul><li>Self </li></ul><ul><li>Instantiating </li></ul><ul><ul><li>myObject = myClass() ‏ </li></ul></u...
Object Orientation <ul><li>Constructors </li></ul><ul><ul><li>class AnotherClass: </li></ul></ul><ul><ul><li>def __init__ ...
Demo  2 <ul><li>Brief networking info </li></ul><ul><li>Sockets </li></ul><ul><li>SocketServer  Framework </li></ul><ul><l...
References <ul><li>http://wiki.python.org </li></ul><ul><li>http://www.python.org/ </li></ul><ul><li>http://en.wikipedia.o...
Thank You <ul><li>Q & A </li></ul>
Upcoming SlideShare
Loading in...5
×

Intro to Python

2,415

Published on

Presentation about introductory Python delivered in front of CSSU.

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

No Downloads
Views
Total Views
2,415
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
203
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Intro to Python

  1. 1. Intro to Python CSSU Nov/28/2007 By Georgi Petrov & Atanas Dyulgerov
  2. 2. Outline <ul><li>What is Python </li></ul><ul><li>Python Advantages </li></ul><ul><li>Who uses Python </li></ul><ul><li>Syntax & Semantics </li></ul><ul><li>Data Structures </li></ul><ul><li>Python Standard Library </li></ul><ul><li>Demo 1 </li></ul><ul><li>Object Orientation </li></ul><ul><li>Demo 2 </li></ul>
  3. 3. What is Python? <ul><li>interpreted, interactive, object-oriented programming language </li></ul><ul><li>Widely used in the industry </li></ul><ul><li>Cousin of Tcl, Perl and VB </li></ul><ul><li>Used in web programming and in standalone applications </li></ul>
  4. 4. Python Advantages <ul><li>Elegant syntax </li></ul><ul><li>Safe </li></ul><ul><li>Object-oriented </li></ul><ul><li>Powerful </li></ul><ul><li>Portable </li></ul><ul><li>Free </li></ul>
  5. 5. Python is simple print &quot;Hello World!&quot; #include <iostream.h> int main() { cout << &quot;Hello World!&quot;; } <ul><li>public class helloWorld </li></ul><ul><li>{ </li></ul><ul><ul><li>public static void main(String [] args) </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>System.out.println(&quot;Hello World!&quot;); </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><li>} </li></ul>Python C++ Java
  6. 6. Python is fun & practical <ul><li>Lack of type declaration </li></ul><ul><li>Huge library of modules </li></ul><ul><li>Widespread use in industry </li></ul><ul><li>Available for all the major platforms (Windows, MacOS, Linux, Unix, BeOS, Java) </li></ul>
  7. 7. Who uses Python <ul><li>Google </li></ul><ul><li>NASA </li></ul><ul><li>Rackspace </li></ul><ul><li>Industrial Light & Magic </li></ul>
  8. 8. Syntax - Indentation
  9. 9. Syntax - Operators <ul><li>Comparison Operators ==, <, >, <=, >= </li></ul><ul><li>Logical Operators Zero values are treated as “”, 0, None, 0.0, [] and {} </li></ul>
  10. 10. Data Structures <ul><li>Base Types integer, float, long integer, octal integer, hexadecimal integer, complex, character string, list, dictionary, tuples, file </li></ul><ul><li>Collection types </li></ul><ul><li>sequences & mappings </li></ul><ul><li>Object system </li></ul>
  11. 11. Python Standard Library <ul><li>The greatest strengths of Python </li></ul><ul><li>Hundreds of modules </li></ul><ul><li>Examples </li></ul><ul><li>Syntax: import email </li></ul>email , math , calendar , HTMLParser
  12. 12. Object Oriented Mechanism <ul><li>Similar to C++ and Java </li></ul><ul><li>Supports multiple inheritance </li></ul><ul><li>Polymorphism </li></ul><ul><li>No private class members  </li></ul>class Stack: def __init__(self,size): self.data = [None]*size self.size = 0   def push(self,item): self.data[self.size] = item self.size = self.size + 1   def pop(self): self.size = self.size - 1 return self.data[self.size]   def is_empty(self): return self.size == 0   def is_full(self): return self.size == len(self.data)
  13. 13. Demo 1 <ul><li>Adjusting Apache to read Python </li></ul><ul><li>Sample “Hello World” script </li></ul>
  14. 14. Object Orientation <ul><li>Defining classes </li></ul><ul><ul><li>class SomeClass: </li></ul></ul><ul><ul><li> &quot;Just some class...that's all.&quot; </li></ul></ul><ul><li>Adding data members and methods </li></ul><ul><ul><li>class SomeClass </li></ul></ul><ul><ul><li> &quot;Just some class...that's all.&quot; </li></ul></ul><ul><ul><li>someNumber = 2131 </li></ul></ul><ul><ul><li>def someFunction ( self ): </li></ul></ul><ul><ul><li>return someNumber </li></ul></ul>
  15. 15. Object Orientation <ul><li>Self </li></ul><ul><li>Instantiating </li></ul><ul><ul><li>myObject = myClass() ‏ </li></ul></ul><ul><li>Calling and addressing </li></ul><ul><ul><li>myObject.someFunction() ‏ </li></ul></ul><ul><li>Deletion </li></ul><ul><ul><li>del myObject.someNumber </li></ul></ul>
  16. 16. Object Orientation <ul><li>Constructors </li></ul><ul><ul><li>class AnotherClass: </li></ul></ul><ul><ul><li>def __init__ ( self, anotherArgument ): </li></ul></ul><ul><ul><li>self.anotherArgument = anotherArgument </li></ul></ul><ul><li>Single/Multiple Inheritance and Overriding </li></ul><ul><ul><li>class ParentClass: </li></ul></ul><ul><ul><li>def print( self ): </li></ul></ul><ul><ul><li>print “parent” </li></ul></ul><ul><ul><li>class ChildClass ( ParentClass ): </li></ul></ul><ul><ul><li>def print( self ): </li></ul></ul><ul><ul><li>print “child” </li></ul></ul>
  17. 17. Demo 2 <ul><li>Brief networking info </li></ul><ul><li>Sockets </li></ul><ul><li>SocketServer Framework </li></ul><ul><li>Ports and Addresses </li></ul><ul><li>Demo </li></ul>
  18. 18. References <ul><li>http://wiki.python.org </li></ul><ul><li>http://www.python.org/ </li></ul><ul><li>http://en.wikipedia.org/wiki/Python_(programming_language) </li></ul>
  19. 19. Thank You <ul><li>Q & A </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×