Python  – Learn from Basic to Advanced

INTRODUCTION TO PYTHON

Python Basic Tutorial

The official introduction to Python is:

Python was created by Guido van Rossum in 1991 at the National Research Institute for Mathematics and Computer Science, Netherland.

  • Python is based on the ABC language, a teaching language created to replace the programming language BASIC.

  • Python is a simple but powerful scripting language.

  • Python is a general-purpose, dynamic, interpreted, interactive, high-level, multiplatform, object-oriented programming language.

  • It incorporates modules, exceptions, dynamic typing, very high-level dynamic data types, and classes.

  • One of its most visible features is that it does not use semicolons and brackets, Python uses indentation instead.

The story behind the name

Guido van Rossum, the creator of the Python language, named the language after the BBC show “Monty Python’s Flying Circus”. He doesn’t particularly like snakes that kill animals for food by winding their long bodies around them and crushing them.

Features of Python

  • Python is a high-level language. It is a free and open-source language.

  • It is an interpreted language, as Python programs are executed by an interpreter.

  • Python programs are easy to understand as they have a clearly defined syntax and relatively simple structure.

  • Python is case-sensitive. For example, NUMBER and number are not same in Python.

  • Python is portable and platform-independent, which means it can run on various operating systems and hardware platforms.

  • Python is also helpful in web development. Many popular web services and applications are built using Python.

  • Python uses indentation for blocks and nested blocks

  • Python provides interfaces to all major commercial databases..

Limitation (Minus) of python:

  • Not the fastest language.

  • Lesser Libraries than C, Java or Perl.

  • Not Strong on Type-binding

  • Not Easily convertible

Downloading and Installing Python

Python can be downloaded and installed for free from

Caution: When you are given the option of unchecking any “optional” components, don’t uncheck any.

  • ANACONDA Python distribution is one such highly recommended distribution that comes with preloaded many packages and libraries (NumPy, SciPy, Panda etc)

  • Other Popular IDEs like Sypder, PytCharm, etc. Spyder IDE is available as a part of ANACONDA.

Working in Python:

  • In Python we can work in 2 ways:

 

1) Working in Interactive mode:

  • Interactive mode: Interactive Mode, as the name suggests, allows us to interact with OS. For working in the interactive mode, we will start Python on our computer.

  • Interactive mode is a command-line environment called as Shell of Python which gives immediate result for each statement fed from the prompt.

  • The >>> (prompt) is Python's way of telling you that you are in interactive mode and here we can enter our one-line statement.

Working in Script Mode:

  • In script mode, we type Python program in a file and then use the interpreter to execute the content from the file. Working in interactive mode is convenient for beginners.

  • Multiple commands can be saved in a file as a program and then we can execute the entire program

  • We type Python program in a file and then use the interpreter to execute the content from the file.

  • Working in interactive mode is convenient for beginners and for testing small pieces of code, as we can test them immediately.

  • But for coding more than few lines, we should always save our code so that we may modify and reuse the code

After starting IDLE from start menu, IDLE open its window

1. File>Open OR File>New Window (for creating a new script file)

2. Write the Python code as function i.e. script

3. Save it (^S)

Executing Python Program

Click Run menu ->  click on Run Module command or  press F5 key to execute the program

4. If the code is written correctly, you will see the output in the Python Shell window

 
 
 
 
 
 
 

 This site is visited

Contact us - 

+91-8076665624