FDP- 102
on
Python: Essentials,
Programming and Analytics
Session-I: Introduction to Python
Taken by
Dr. Aakash,
Assistant Professor (Operation & IT),
Amity University, Noida, Uttar
Pradesh
Date: 28-Oct-2022 (Friday)
Timings: 3.00 PM to 5.00 PM
          •   Python: Dynamic programming
What is       language    which    supports
              several different programing
              paradigms:
Python?       o Procedural Programming
              o Object            Oriented
                  Programming (OOP)
              o Functional Programming
          •   Standard: Python byte code is
              executed in the Python
              interpreter (similar to Java)
          •   → platform independent code
          •   Extremely versatile language
              o Website development, data
Why               analysis,
                  maintenance,
                  analysis, etc.
                                          server
                                      numerical
          •
Python?   •
              Syntax is clear, easy to read and
              learn (almost pseudo code)
              Common language
          •   Intuitive     object      oriented
              programming
          •   Full modularity, hierarchical
              packages
          •   Comprehensive standard library
              for many tasks
          •   Big community
          •   Simply extendable via C/C++,
              wrapping of C/C++ libraries
          •   Focus: Programming speed
           •
Who uses   •
               On-line games
               Web services
           •   Applications
Python?    •   Science
           •   Instrument control
           •   Embedded systems
           Link:
           en.wikipedia.org/wiki/Lis
           t_of_Python_software
              Python is used for everything!
So who uses   For example:
              • “massively        multiplayer
Python and       online role-playing games”
                 like Eve Online, science
                 fiction’s answer to World of
what for?        Warcraft,
              • web applications written in
                 a framework built on
                 Python called “Django”,
              • desktop applications like
                 Blender, the 3-d animation
                 suite      which      makes
                 considerable use of Python
                 scripts,
              • the Scientific Python
                 libraries        (“NumPy”),
                 instrument control and
                 embedded systems
What sort of
language is
Python?
             •   Python does not have to be
                 explicitly compiled but
                 behind the scenes there is a
Continued…       system      that    compiles
                 Python into an intermediate
                 code which is stashed away
                 to make things faster in
                 future.
             •   But it does this without you
                 having to do anything
                 explicit yourself.
             •   So from the point of view of
                 how you use it you can treat
                 it as a purely interpreted
                 language like the shell or
                 Perl.
          •   Start implementation in December
              1989 by Guido van Rossum (CWI)
          •   16.10.2000: Python 2.0
              o Unicode support
              o Garbage collector
              o Development process more
                   community oriented
          •   3.12.2008: Python 3.0
              o Not 100% backwards compatible
          •
History       2007     &    2010     most    popular
              programming language (TIOBE Index: is
              an indicator of the popularity of
              programming languages.)
          •   Recommendation        for    scientific
              programming (Nature News, NPG,
              2015)
          •   Current version (October 24, 2022):
              Python            3.11           (Link:
              https://www.python.org/ftp/python/3.
              11.0/python-3.11.0-amd64.exe)
          •   Python 2 is out of support! (Link:
              https://python3statement.org/)
         11      software    principles     that
         influence the design of Python:
         1) Beautiful is better than ugly.
Zen of   2) Explicit is better than implicit.
         3) Simple is better than complex.
         4) Complex is better than
Python        complicated.
         5) Flat is better than nested.
         6) Sparse is better than dense.
         7) Readability counts.
         8) Special cases aren’t special
              enough to break the rules.
         9) Although practicality beats
              purity.
         10)Errors should never pass
              silently.
         11)Unless explicitly silenced.
Is Python   • For     user programs: Python is
                fast enough!
fast        •   Most parts of Python are
                written in C
            •
enough?         For       compute        intensive
                algorithms: Fortran, C, C++
                might be better
            •   Performance-critical parts can
                be re-implemented in C/C++ if
                necessary
            •   First analyze, then optimize!
Technical      •   Downloads Link:
                   http://www.python.org
Issues:        •   Documentation Link:
                   http://www.python.org/doc/
Installing &   •   Free book Link:
                   http://www.diveintopython.org
Running        •   Python comes pre-
                   installed with Mac OS X
Python         •
                   and Linux.
                   Windows binaries from
               •   Link: http://python.org/
               •   You might not have to do
                   anything!
             •   Go to www.python.org and
                 download the latest version
                 of Python (version 3.11 or
                 3.7 as of this writing).
Installing   •   It should be painless to
                 install.
Python       •   If you have a Mac or Linux,
                 you may already have
                 Python on your computer,
                 though it may be an older
                 version.
             •   If it is version 2.7 or earlier,
                 then you should install the
                 latest version, as many of
                 the programs in this book
                 will not work correctly on
                 older versions.
            METHODS
How to      1) Installing Python 3
            2) Installing Python 2
Install     3) Adding the Python Path
Python on      to Windows
Windows     • Link for Guiding
              Python Installation
              in Windows:
              https://www.wikihow.c
              om/Install-Python-on-
              Windows
The interpreter can be started in interactive mode
                •   IDLE is a simple integrated
                    development      environment
                    (IDE) that comes with Python.
Integrated
Development     •   It’s a program that allows you
                    to type in your programs and
Environment (       run them.
IDLE)           •   There are other IDEs for
                    Python, but for now I would
                    suggest sticking with IDLE as it
                    is simple to use.
                •   You can find IDLE in the
                    Python 3.4 folder on your
                    computer.
             •   When you first start IDLE, it
                 starts up in the shell, which
                 is an interactive window
                 where you can type in
                 Python code and see the
CONTINUED…       output in the same window.
             •   I often use the shell in place
                 of my calculator or to try
                 out small pieces of code.
             •   But most of the time you
                 will want to open up a new
                 window and type the
                 program in there.