http://www.skillbrew.com
/SkillbrewTalent brewed by the industry itself
What is Python
Pavan Verma
1
@YinYangPavan
Python Programming Essentials
2
Hello World in Python
© SkillBrew http://skillbrew.com
Brief history of Python
 Invented by Guido Van Rossum in
early 90s
 Named after comedy group Monty
Python
 First public release in 1991
 Open source from beginning
 Managed by Python Software
foundation (PSF)
3
© SkillBrew http://skillbrew.com
Python Features
4
• Python has relatively few keywords,
simple structure, and a clearly
defined syntax
Easy-to-learn
• Python lets you get more done with
less code and less time
Rapid development
• One of Python's greatest strengths
is the bulk of the library is
portable and cross-platform
compatible on *nix and windows
Powerful standard
library
© SkillBrew http://skillbrew.com
Python Features
5
• Python interpreter lets you try out
code right away in its interactive
mode
Interactive mode
• Python can run on a wide variety of
platformsPortable
• Python is a dynamically typed
languages. Types are assigned at
run-time
Dynamically typed
© SkillBrew http://skillbrew.com
Who uses Python
6
© SkillBrew http://skillbrew.com
What do people use Python for
7
Web and Internet Development
Desktop GUIs
Scientific and Numeric computing
Network Programming
Database Access
© SkillBrew http://skillbrew.com
Some interesting projects
8
© SkillBrew http://skillbrew.com
Python Community
 Very active communities around Python and
projects written in Python
 PyPi – the Python Package Index,
https://pypi.python.org/pypi
9
10
How does Python compare with some
other popular languages?
© SkillBrew http://skillbrew.com
Python is better
 Faster to learn
 Portable code
 Much smaller and compact
code
 Automatic garbage collection
 Easy to find and install 3rd party
libraries
 More powerful standard library
 5-10 times higher programmer
productivity
C/C++ is better
 Faster
11
Python vs C/C++
© SkillBrew http://skillbrew.com
Python is better
 Faster to learn
 Smaller and compact code
 3-5 times higher
programmer productivity
Java is better
 Faster
12
Python vs Java
© SkillBrew http://skillbrew.com
Python is better
 More versatile, general
purpose language
 Easy to find and install 3rd
party libraries
PHP is better
 Faster to get started with
 Cheap web hosting
 Huge installed base
13
Python vs PHP
© SkillBrew http://skillbrew.com
Python is better
 More tidy & readable code
 Proper support for objects
oriented programming
 More general purpose and
adopted in variety of
application domains
Perl is better
14
Python vs Perl
© SkillBrew http://skillbrew.com
Python vs Ruby
 Python and Ruby have lot in common
 Both are widely adopted in variety of application
domains
 Both have popular and successful applications written
using them
 Both have very active and supportive communities
15
16
Python Interpreter
© SkillBrew http://skillbrew.com
Python interpreter
17
• The interpreter is a program which lets you
type in code and give outputs right away
• This is a very easy and effective way to learn
Python
• This is where you will end up spending most of
your time
© SkillBrew http://skillbrew.com
Sneak peak into an interpreter session
18
>>> x = 25
>>> y = 10
>>> x - y
15
>>> 4**2 # square of 4
16
>>> print "Python rocks" # print a string
Python rocks
>>> print "Python rocks".upper()
PYTHON ROCKS
© SkillBrew http://skillbrew.com
Sneak peak into an interpreter session (2)
19
>>> 100/12 # divison
8
>>> colors = ['brown', 'black', 'orange']
>>> colors # a list of colors
['brown', 'black', 'orange']
>>>
© SkillBrew http://skillbrew.com
Awesome Standard Library
20
• Python ships with an extensive standard
library
• Hundreds of modules for doing a variety
of things – interacting with the operating
system, filesystem, Internet, and more
• Well tested and widely used
• Can greatly help jump-start
development of your applications
© SkillBrew http://skillbrew.com
• We will be using Python 2.7.x but even Python
2.5 and above will work
• Examples, quiz and assignment all are meant
to be done in Python 2.x
• Please don’t use Python 3.x for this class due
to backward compatibility issue
Python Versions
 Python 2.x
 Python 3.x
21
© SkillBrew http://skillbrew.com
Summary
 Brief history of Python
 Python features
 Who uses Python
 What people use Python for
 Some interesting projects written in Python
 Comparison with other popular languages
 Python interpreter
22
© SkillBrew http://skillbrew.com
References
 List of application domains where Python is used
http://www.Python.org/about/apps/
 List of Internet companies that use Python http://www.quora.com/Python-
programming-language-1/Which-Internet-companies-use-Python
 Guido von Rossum personal home page http://www.Python.org/~guido/
 Reddit site http://www.reddit.com/
 Source code for reddit.com https://github.com/reddit/reddit
 Pinterest site https://www.pinterest.com/
23
© SkillBrew http://skillbrew.com
References (2)
 Blog post about Python in Disqus
http://blog.disqus.com/post/51155103801/trying-out-this-go-thing
 Blog post about Python in Instagram http://instagram-
engineering.tumblr.com/post/13649370142/what-powers-instagram-
hundreds-of-instances-dozens-of
 Pygtk website http://www.pygtk.org/
 TkInter GUI library https://wiki.Python.org/moin/TkInter
24
© SkillBrew http://skillbrew.com
References (3)
 PyGame Wikipedia page http://en.wikipedia.org/wiki/Pygame
 OpenStack project website http://www.openstack.org/
 Matplotlib website http://matplotlib.org/
 Scipy website http://www.scipy.org/
 Flask website http://flask.pocoo.org/
 TurboGears on Wikipedia http://turbogears.org/
 Django Project website https://www.djangoproject.com/
25
26

Python Programming Essentials - M2 - Introduction to Python

  • 1.
    http://www.skillbrew.com /SkillbrewTalent brewed bythe industry itself What is Python Pavan Verma 1 @YinYangPavan Python Programming Essentials
  • 2.
  • 3.
    © SkillBrew http://skillbrew.com Briefhistory of Python  Invented by Guido Van Rossum in early 90s  Named after comedy group Monty Python  First public release in 1991  Open source from beginning  Managed by Python Software foundation (PSF) 3
  • 4.
    © SkillBrew http://skillbrew.com PythonFeatures 4 • Python has relatively few keywords, simple structure, and a clearly defined syntax Easy-to-learn • Python lets you get more done with less code and less time Rapid development • One of Python's greatest strengths is the bulk of the library is portable and cross-platform compatible on *nix and windows Powerful standard library
  • 5.
    © SkillBrew http://skillbrew.com PythonFeatures 5 • Python interpreter lets you try out code right away in its interactive mode Interactive mode • Python can run on a wide variety of platformsPortable • Python is a dynamically typed languages. Types are assigned at run-time Dynamically typed
  • 6.
  • 7.
    © SkillBrew http://skillbrew.com Whatdo people use Python for 7 Web and Internet Development Desktop GUIs Scientific and Numeric computing Network Programming Database Access
  • 8.
  • 9.
    © SkillBrew http://skillbrew.com PythonCommunity  Very active communities around Python and projects written in Python  PyPi – the Python Package Index, https://pypi.python.org/pypi 9
  • 10.
    10 How does Pythoncompare with some other popular languages?
  • 11.
    © SkillBrew http://skillbrew.com Pythonis better  Faster to learn  Portable code  Much smaller and compact code  Automatic garbage collection  Easy to find and install 3rd party libraries  More powerful standard library  5-10 times higher programmer productivity C/C++ is better  Faster 11 Python vs C/C++
  • 12.
    © SkillBrew http://skillbrew.com Pythonis better  Faster to learn  Smaller and compact code  3-5 times higher programmer productivity Java is better  Faster 12 Python vs Java
  • 13.
    © SkillBrew http://skillbrew.com Pythonis better  More versatile, general purpose language  Easy to find and install 3rd party libraries PHP is better  Faster to get started with  Cheap web hosting  Huge installed base 13 Python vs PHP
  • 14.
    © SkillBrew http://skillbrew.com Pythonis better  More tidy & readable code  Proper support for objects oriented programming  More general purpose and adopted in variety of application domains Perl is better 14 Python vs Perl
  • 15.
    © SkillBrew http://skillbrew.com Pythonvs Ruby  Python and Ruby have lot in common  Both are widely adopted in variety of application domains  Both have popular and successful applications written using them  Both have very active and supportive communities 15
  • 16.
  • 17.
    © SkillBrew http://skillbrew.com Pythoninterpreter 17 • The interpreter is a program which lets you type in code and give outputs right away • This is a very easy and effective way to learn Python • This is where you will end up spending most of your time
  • 18.
    © SkillBrew http://skillbrew.com Sneakpeak into an interpreter session 18 >>> x = 25 >>> y = 10 >>> x - y 15 >>> 4**2 # square of 4 16 >>> print "Python rocks" # print a string Python rocks >>> print "Python rocks".upper() PYTHON ROCKS
  • 19.
    © SkillBrew http://skillbrew.com Sneakpeak into an interpreter session (2) 19 >>> 100/12 # divison 8 >>> colors = ['brown', 'black', 'orange'] >>> colors # a list of colors ['brown', 'black', 'orange'] >>>
  • 20.
    © SkillBrew http://skillbrew.com AwesomeStandard Library 20 • Python ships with an extensive standard library • Hundreds of modules for doing a variety of things – interacting with the operating system, filesystem, Internet, and more • Well tested and widely used • Can greatly help jump-start development of your applications
  • 21.
    © SkillBrew http://skillbrew.com •We will be using Python 2.7.x but even Python 2.5 and above will work • Examples, quiz and assignment all are meant to be done in Python 2.x • Please don’t use Python 3.x for this class due to backward compatibility issue Python Versions  Python 2.x  Python 3.x 21
  • 22.
    © SkillBrew http://skillbrew.com Summary Brief history of Python  Python features  Who uses Python  What people use Python for  Some interesting projects written in Python  Comparison with other popular languages  Python interpreter 22
  • 23.
    © SkillBrew http://skillbrew.com References List of application domains where Python is used http://www.Python.org/about/apps/  List of Internet companies that use Python http://www.quora.com/Python- programming-language-1/Which-Internet-companies-use-Python  Guido von Rossum personal home page http://www.Python.org/~guido/  Reddit site http://www.reddit.com/  Source code for reddit.com https://github.com/reddit/reddit  Pinterest site https://www.pinterest.com/ 23
  • 24.
    © SkillBrew http://skillbrew.com References(2)  Blog post about Python in Disqus http://blog.disqus.com/post/51155103801/trying-out-this-go-thing  Blog post about Python in Instagram http://instagram- engineering.tumblr.com/post/13649370142/what-powers-instagram- hundreds-of-instances-dozens-of  Pygtk website http://www.pygtk.org/  TkInter GUI library https://wiki.Python.org/moin/TkInter 24
  • 25.
    © SkillBrew http://skillbrew.com References(3)  PyGame Wikipedia page http://en.wikipedia.org/wiki/Pygame  OpenStack project website http://www.openstack.org/  Matplotlib website http://matplotlib.org/  Scipy website http://www.scipy.org/  Flask website http://flask.pocoo.org/  TurboGears on Wikipedia http://turbogears.org/  Django Project website https://www.djangoproject.com/ 25
  • 26.

Editor's Notes

  • #9 OpenStack is a cloud computing project aimed at providing an infrastructure as a service (IaaS). It is free and open-source software written in Python and uses Python libraries like eventlet(for concurrent programming), kombu(for queue) and SQLAlechemy (Database). matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms Scipy is a Python-based ecosystem of open-source software for mathematics, science, and engineering. In particular, these are some of the core packages: Numpy, Scipy lib, IPython, Sympy, pandas, matplotlib Django is a high-level Python Web framework that encourages rapid development Flask is a micro webdevelopment framework for Python. TurboGears is a Python web application framework Pygame is a cross-platform set of Python modules designed for writing video games.