Learn Python Programming

[siteorigin_widget class=”FT_Widget_Heading”][/siteorigin_widget]

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also available under the GNU General Public License (GPL). This tutorial gives enough understanding on Python programming language.

We are working hard to create easy to follow step by step Python tutorial. Subscribe now, and we’ll let you know once the tutorial is complete.






[siteorigin_widget class=”FT_Widget_Heading”][/siteorigin_widget]

Python Keywords & Identifier
Python Statements & Comments
Python Datatypes
Python I/O and Import
Python Operators

[siteorigin_widget class=”FT_Widget_Heading”][/siteorigin_widget]

Python if…else
Python for Loop
Python while Loop
Python break and continue
Python Pass Statement
Python Looping Technique

[siteorigin_widget class=”FT_Widget_Heading”][/siteorigin_widget]

Python Function
Python Function Argument
Python Recursion
Python Anonymous Function
Python Modules
Python Package

[siteorigin_widget class=”FT_Widget_Heading”][/siteorigin_widget]

Python Numbers
Python List
Python Tuple
Python String
Python Set
Python Dictionary

[siteorigin_widget class=”FT_Widget_Heading”][/siteorigin_widget]

File Operation
Python Directory
Python Exception
Exception Handling
User-defined Exception

[siteorigin_widget class=”FT_Widget_Heading”][/siteorigin_widget]

Python Namespace
Python Class
Python Inheritance
Multiple Inheritance
Operator Overloading

[siteorigin_widget class=”FT_Widget_Heading”][/siteorigin_widget]

Classes/Objects
Reg Expressions
CGI Programming

Database Access
Networking
Sending Email

Multithreading
XML Processing
GUI Programming
Further Extensions

What is Python

Python is a widely used high-level programming language for general-purpose programming, created by Guido van Rossum and first released in 1991.

An interpreted language, Python has a design philosophy which emphasizes code readability (notably using whitespace indentation to delimit code blocks rather than curly brackets or keywords), and a syntax which allows programmers to express concepts in fewer lines of code that might be used in languages such as C++ or Java.

The language provides constructs intended to enable writing clear programs on both a small and large scale.

Python features a dynamic type system and automatic memory management and supports multiple programming paradigms, including object-oriented, imperative, functional programming, and procedural styles. It has a large and comprehensive standard library.

Python interpreters are available for many operating systems, allowing Python code to run on a wide variety of systems. CPython, the reference implementation of Python, is open source software and has a community-based development model, as do nearly all of its variant implementations. CPython is managed by the non-profit Python Software Foundation.


History of Python

Python was conceived in the late 1980s, and its implementation began in December 1989 by Guido van Rossum at Centrum Wiskunde & Informatica (CWI) in the Netherlands as a successor to the ABC language (itself inspired by SETL) capable of exception handling and interfacing with the operating system Amoeba.

Van Rossum is Python’s principal author, and his continuing central role in deciding the direction of Python is reflected in the title given to him by the Python community, benevolent dictator for life (BDFL)

For Detail History of Python Click here.


8 Reasons to Learn Python

1. You Can Use Python for Pretty Much Anything
One significant advantage of learning Python is that it’s a general-purpose language that can be applied in a large variety of projects. Below are just some of the most common fields where Python has found its use:

  • 1. Data science
  • 2. Scientific and mathematical computing
  • 3. Web development
  • 4. Finance and trading
  • 5. System automation and administration
  • 6. Computer graphics
  • 7. Basic game development
  • 8. Security and penetration testing
  • 9. General and application-specific scripting
  • 10. Mapping and Geography (GIS software)

2. Python Is Widely Used in Data Science
Python’s application in data science and data engineering is what’s really fuelling its popularity today. Pandas, NumPy, SciPy, and other tools combined with the ability to prototype quickly and then “glue” systems together enable data engineers to maintain high efficiency when using Python.

Justin McGrath, a researcher at the University of Illinois, Champaign-Urbana agrees:

Python is probably going to become the de facto standard for scientific and statistical analyses. If you’re going into those fields, it’s certainly worth learning.”

3. Python Pays Well
It’s all well and good, but what about the pay, I hear you ask? It turns out Python engineers have some of the highest salaries in the industry, at least in the US.

At nearly $103,500 per year, Python is the second best-paying programming language in the country (beating out Java, C++, and JavaScript) according to Gooroo, a skill, and salary analytics platform.

Indeed’s salary calculator gives an even larger figure—a whopping $116,000 per year. Of course, tech salaries differ greatly from one state to another. So to add some context here’s a breakdown of how much Python engineers make in the states featured on Indeed

4. Demand for Python Developers Is High (And Growing)
Based on Indeed’s job trends, it looks like having Python under your belt can help you land a job in very short terms. The graph below displays a steady growth in the number of job postings featuring Python since 2012, and there has been a strong spike in popularity over the last six months.

5. Python Saves Time
I’m pretty sure that the majority of the developers who’ve used Python would agree that making anything with this language takes a lot less time and code than most other technologies.Even the classic “Hello, world” program illustrates this point:

print("Hello, world")

For comparison, this is what the same program looks like in Java:

public class HelloWorld {
            public static void main(String[] args) {
                System.out.println("Hello, world");
            }
        }

6. Python Is Beginner Friendly
Following up on the previous point, Python’s famously clean and readable syntax makes it newbie-friendly. A well-written Python program can look like it came straight out of an algorithms textbook.

There’s little superfluous boilerplate, allowing beginners and experts alike to focus on the job at hand—instead of the code.

Python’s efficiency and readability have also made it the number one most commonly taught introductory language at top US universities. This will have ramifications on the future job market and likely make Python an even more popular technology choice.

7. All the Big Names Use Python
Ever wanted to work for a tech giant like Google or Facebook? Python could be your way in, as these companies, as well as YouTube, IBM, Yahoo, Dropbox, Quora, Mozilla, Instagram, and many others all use Python for a wide array of purposes, and are constantly hiring Python developers.

Dropbox’s code base, for instance, uses Python for almost everything, including analytics, the server backend, the API backend, and the desktop clients.

8. Python Has an Amazing Ecosystem
Last but not least, there’s a huge number of resources developed for Python that keeps getting updated, including an impressive standard library with built-in functionality, a built-in unit testing framework, and more than enough frameworks and environments that allow you to focus on writing the website or app at hand.Django is the most commonly used Python web framework, but there’s also FlaskPyramidweb2pyZope 2, and a few more.


Python Installation

You will find the easiest way to run Python on your computer (Windows, Mac OS X or Linux) in this section.

Install and Run Python on Mac OS X

  1. Go to Download Python page on the official site and click Download Python 3.6.0 (You may see different version name).
  2. When the download is complete, open the package and follow the instructions. You will see “The installation was successful” message when Python is successfully installed.
  3. It’s recommended to download a good text editor before you get started. If you are a beginner, I suggest you download Sublime Text. It’s free.
  4. The installation process is straightforward. Run the Sublime Text Disk Image file you downloaded and follow the instructions.
  5. Open Sublime Text and go to File > New File (Shortcut: Cmd+N). Then, save (Cmd+S or File > Save) the file with .py extension like: hello.py or first-program.py
  6. Write the code and save it again. For starters, you can copy the code below:
    print("Hello, World!")

    This simple program outputs “Hello, World!”

  7. Go to Tool > Build (Shortcut: Cmd + B). You will see the output at the bottom of Sublime Text.Congratulations, you’ve successfully run your first Python program.

Install and Run Python on Linux (Ubuntu)

  1. Install the following dependencies:
    $ sudo apt-get install build-essential checkinstall
            $ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
  2. Go to Download Python page on the official site and click Download Python 3.6.0 (You may see different version name).
  3. In the terminal, go to the directory where the file is downloaded and run the command:
    $ tar -xvf Python-3.6.0.tgz

    This will extract your zipped file.
    Note: The filename will be different if you’ve downloaded a different version. Use the appropriate filename.

  4. Go to the extracted directory.
    $ cd Python-3.6.0
  5. Issue the following commands to compile Python source code on your Operating system.
    $ ./configure
            $ make
            $ make install
    
  6. We recommend you to install Sublime Text if you are a newbie. To install Sublime Text in Ubuntu (on 14.04). Issue following commands.
    $ sudo add-apt-repository -y ppa:webupd8team/sublime-text-2
            $ sudo apt-get update
            $ sudo apt-get install sublime-text
  7. Open Sublime text. To create a new file, go to File > New File (Shortcut: Ctrl+N).
  8. Save the file with .py file extensions like hello.py or first-program.py
  9. Write the code and save it (Ctrl+S or File > Save). For starters, you can copy the code below:
    print("Hello, World!")

    This simple program outputs “Hello, World!”

  10. Go to Tool > Build (Shortcut: Ctrl+B). You will see the output at the bottom of Sublime Text. Congratulations, you’ve successfully run your first Python program.

Install and Run Python on Windows

  1. Go to Download Python page on the official site and click Download Python 3.6.0 (You may see different version name).
  2. When the download is completed, double-click the file and follow the instructions to install it.
    When Python is installed, a program called IDLE is also installed along with it. It provides the graphical user interface to work with Python.
  3. Open IDLE, copy the following code below and press enter.
    print("Hello, World!")
    
  4. To create a file in IDLE, go to File > New Window (Shortcut: Ctrl+N).
  5. Write Python code (you can copy the code below for now) and save (Shortcut: Ctrl+S) with .py file extension like hello.py or your-first-program.py
    print("Hello, World!")
  6. Go to the Run > Run module (Shortcut: F5) and you can see the output. Congratulations, you’ve successfully run your first Python program.

Recommended Python Books

1. Think Python: How to Think Like a Computer Scientist

2. Starting out With Python

3. Effective Python: 59 Specific Ways to Write Better Python

4. Data Structure and Algorithmic Thinking with Python