Python Tutorial Final V2
Python Tutorial Final V2
d. Brython ....................................................................................................................................... 8
e. RubyPython ................................................................................................................................. 8
f. PyPy.............................................................................................................................................. 8
g. MicroPython ................................................................................................................................ 8
9. Python File Extensions .................................................................................................................... 8
10. Why should I learn Python? .......................................................................................................... 8
11. How is Python different from Java or C++? .................................................................................. 9
12. Python Constructs ....................................................................................................................... 10
a. List ............................................................................................................................................. 10
b. Tuple ......................................................................................................................................... 10
c. Dictionary .................................................................................................................................. 10
d. Comments and Docstrings- ....................................................................................................... 10
1
https://data-flair.training/blogs/category/python/
Python Tutorial
1. Python Tutorial
Python Tutorial
Read: Python V/s Java
2. What is Python?
2
https://data-flair.training/blogs/category/python/
Python Tutorial
3. Python History
Python programming language was conceived in the late 1980s and was
named for the BBC TV show Monty Python’s Flying Circus. Guido van Rossum
started python implementation at CWI in the Netherlands in December 1989.
This was a successor to the ABC (programming language) which was capable
of exception handling and interfacing with the Amoeba operating system.
On October 16, 2000, python 2.0 release was there and it had many major
new features, that includes cycle-detecting garbage collector for memory
management and support for Unicode.
Next version of Python 3.0 was released on December 3, 2008.
Now we know how Python came to the picture. Now let us jump to the
Python Architecture in this Python Tutorial.
Read: Real World Applications of Python
4. Architecture
3
https://data-flair.training/blogs/category/python/
Python Tutorial
b. Compiler
It turns the abstract syntax tree into Python byte code.
c. Interpreter
It executes the code line by line.
In the below topic of python tutorial, we will cover the components of python
programming language.
Read: Pros and Cons of Python
5. Components of Python
a. Functions
A function is a collection of statements named into one. You can use it when
you want to execute all those statements at a time. You can call it wherever
you want in a program. A function may return a value.
b. Classes
As we discussed, Python is an object-oriented language. It supports classes
and objects. A class is an abstract data type. In other words, it is a blueprint
for an object of a certain kind. It holds no values.
c. Modules
A Python module is a collection of related classes and functions. We have
modules for mathematical calculations, string manipulations, web
programming, and many more.
d. Packages
A package is a collection of related modules. You can either import a package
or create your own.
Now let us learn about the features of Python in this python tutorial. Based
on these features you will be able to choose a programming language for
your new project.
Read: Python Career Opportunities
6. Features of Python
Python is one of the richest language, in this python tutorial we will discuss
several features of python:
4
https://data-flair.training/blogs/category/python/
Python Tutorial
5
https://data-flair.training/blogs/category/python/
Python Tutorial
a. Django
This is a free and open-source framework that was written in Python and is
the most common framework for Python. It allows you to create database-
driven websites. It follows the DRY Principle (Don’t Repeat Yourself). Popular
websites like Instagram, Mozilla, and Disqus make use of it.
b. Flask
Like Django, Flask is a web framework written in Python. It is a micro
framework because it does not need certain libraries and tools. It also does
not have form validation or a database abstraction layer. However, you can
make use of extensions to add extra features.
c. Pyramid
Pyramid is another web framework. It is neither a mega-framework that
would make decisions for you nor a micro-framework that wouldn’t force
decisions. It gives you optimal liberty on your project.
d. Tornado
Another open-source web framework, it was written in Python. It is noted for
its excellent performance and scalability.
e. Bottle
Like Flask, it is a micro-framework for Python. It is used for web
development. Bottle is known for its speed, simplicity, and light-weight. A
single file can run both Python 2.5+ and 3.x
f. web2py
Written in Python, web2py is another open source web framework. It
emphasizes on rapid development, and follows an MVC architecture. MVC
stands for Model View Controller.
6
https://data-flair.training/blogs/category/python/
Python Tutorial
g. NumPy
NumPy is an open-source framework for Python. It is used for scientific
computing. It supports large multidimensional arrays and matrices, and
functions to operate on them.
h. SciPy
SciPy is a Python library that you can use for scientific computing. It has
modules for linear algebra, interpolation, fast Fourier transform, image
processing, and many more. It uses a multidimensional array from the
NumPy module.
i. Pylons
This is a deprecated framework, which means it is no longer recommended.
It is a web framework, and is open source as well. It makes extensive use of
third-party tools.
Next chapter in the Python tutorial is the different Flavors of Python.
Read: Python Variables and Data Types
8. Flavors of Python
7
https://data-flair.training/blogs/category/python/
Python Tutorial
b. Jython
Jython is a Python implementation written in Java. A Jython program can
import any Java class. It compiles to Java bytecode.
c. IronPython
IronPython is implemented in C#. It can function as an extensibility layer to
application frameworks written in a .NET language.
d. Brython
Brython stands for Browser Python. It is an implementation of Python that
runs in the browser.
e. RubyPython
It acts as a bridge between the Python and Ruby interpreters. It marshals
data between Python and Ruby virtual machines.
f. PyPy
It is interesting to know that PyPy is Python implemented in Python. This
makes it faster and easier to experiment with. However, the standard
implementation is CPython.
g. MicroPython
This is an implementation of Python meant to run on a microcontroller. It
uses a MicroPython board that runs MicroPython on bare metal.
Lets also see some Python File Extensions in this Python Tutorial
Read: Best Python Books
In this python tutorial we will also try to answer some of your questions
regarding python, one of which is: Why should I learn Python.
8
https://data-flair.training/blogs/category/python/
Python Tutorial
Build a website
Develop a game
Perform Computer Vision (Facilities like face-detection and color-
detection)
Do Machine Learning (Giving a computer the ability to learn)
Enable Robotics
Perform Web Scraping (Harvesting data from websites)
Perform Data Analysis
Automate a web browser
Perform Scripting
Perform Scientific Computing
Build Artificial Intelligence
Install Python Now to start playing with the python programming language
Python isn’t limited to these applications. If you’ve ever used services from
brands like YouTube, Dropbox, and Netflix, then you’ve used Python. The
search-engine Google also made great use of the language in its initial
stages.
When writing code in Python, you need fewer lines of code. This high-level
language is also open-source and free. It is among the major programming
languages with the fastest growth. So if you plan to make a career out of it,
you’re lucky to be born in the 21st century.
To make you more clear about the python programming language we have
covered how Python is different from other programming languages like Java
or C++. Lets see how python is different from Java and C in this Python
Tutorial.
Python uses whitespace indentation to delimit code, so you don’t need to use
curly braces for that. Also, semicolons are optional. Both
following syntax are correct:
a=7
print(a)
a = 7;
print(a)
9
https://data-flair.training/blogs/category/python/
Python Tutorial
10
https://data-flair.training/blogs/category/python/
Python Tutorial
“””
This is a docstring
“””
A lot of other constructs are also available. These include control structures,
functions, exceptions, etc. which will be discussed in further tutorials
This is all about the python tutorial. Lets come to the conclusion.
Read: Python Syntax and Semantics for Beginners
This covers the Big Picture, but this is not end. It’s the beginning of Learning Python. Here are the
next steps that you need to start the actual journey with Python. You get the links in these articles to
keep on learning Python.
1. Python Tools
2. Python for Data Science
3. Python Syntax
4. Python Number Types
5. Python Variables and Data Types
11
https://data-flair.training/blogs/category/python/