Skip to main content

INTRODUCTION TO PYTHON

HISTORY OF PYTHON


Python was developed by Guido van Rossum in 1989 at the National Research Institute for Mathematics and Computer Science in Netherlands.


Python got its name from a BBC comedy series from seventies- “Monty Python’s Flying Circus”.


FEATURES OF PYTHON


EASY TO READ AND WRITE : Python is easy to read and write. It is developer-friendly. Reading a good Python program feels almost like reading English (but very strict English!). This pseudo-code nature of Python makes it easy to learn and use.


SUPPORTS DIFFERENT PROGRAMMING PARADIGMS: Python supports procedure-oriented programming as well as object-oriented programming.


EASILY EXTENSIBLE : It is easily extensible. It implies that other languages such as C/C++ can be used to compile the code and which can be used further in our python code.


HIGH LEVEL PROGRAMMING LANGUAGE : When we write programs in Python, we never need to bother about low-level details such as managing the memory used by our program.


FREE SOFTWARE : Python is free software in two senses. It doesn't cost anything to download or use Python, or to include it in our application. Python can also be freely modified and re-distributed, because while the language is copyrighted it's available under an open source license.


VAST LIBRARY OF ADD-ON MODULES : Python has a large and broad library and provides rich set of module and functions for rapid application development.


CONTAINS ADVANCED PROGRAMMING FEATURES: Python contains advanced programming features such as generators and list comprehensions. It's automatic memory management frees us from having to manually allocate and free memory in our code.


PLATFORM INDEPENDENT: Python runs anywhere, including Mac OS X, Windows, Linux, and Unix, with unofficial builds also available for Android and iOS. It is also called cross platform language.


DATABASES : Python provides interfaces to all major commercial databases.


USES OF PYTHON


Many organizations are using Python these days to perform major tasks. Here are some major ways in which Python is used commercially:


Google uses Python in its web search systems.


You tube's video sharing service largely uses Python.


Bit Torrent peer to peer file sharing is written using Python.


Spotify applies Python in its back-end services, and for data analysis purposes.


Instagram Uses Python language in combination with Django.


NASA uses Python for scientific programming task.


Amazon uses Python to analyze customer’s buying habits and search patterns.


Facebook Uses Python largely to process images.


PYTHON INSTALLATION


Different versions are available for Windows, Linux/Unix, Mac OS X, and other operating systems. To download Python:


Go to www.python.org


Go to downloads




Here we are using Python 3.6.5, so


Click on Python 3.6.5


Click on Python 3.6.5.exe and install it


Once you download this software, you have to install it on your computer. Installation is very easy. You simply have to double click the icon representing this software and follow the instructions that appear on the screen.


When we install Python on our computer, we actually install the Python IDE. Python IDE is called IDLE (Integrated Development and Learning Environment).




PYTHON IDLE


IDLE is an acronym of Integrated Development Environment and is the standard, most popular Python development environment.


To run a program, we basically need an editor to write it, an interpreter/compiler to execute it and a debugger to catch and remove the errors. Python IDLE provides all these tools as a bundle. It lets edit, run, browse and debug Python Programs from a single interface and makes it easy to write programs.


When you start IDLE, computer opens the Python window (Called the Python Shell) as shown here.




It shows you a welcome message stating its version number and a copyright notice. After this information it shows you the primary prompt (>>>) followed by a blinking cursor. It indicates that IDLE is now ready to take Python commands from the user.


IDLE can be used in two modes: Interactive mode and Script mode.Python shell is an interactive interpreterPython editor allows us to work in script mode i.e. we can create and edit python source file.


PYTHON SHELL INTERACTIVE MODE


">>>" is a Python prompt which indicates that IDLE is working in interactive mode and is ready for instruction. In this mode it prompts for the next command with the prompt (>>>).




We can type Python expression / statement / command after the prompt and Python immediately responds with the output of it.


NOTE: ^D (Ctrl+D) or quit() is used to leave the interpreter. ^F6 will restart the shell.




NOTE : Press Alt+P to repeat the previous command.


PYTHON EDITOR SCRIPT MODE


To start the Python script mode goto File->New File or File->Open. A new window will open. Write your Python script here and save it. Execute the script by using Run option or ^F5. Result of execution of Python script will be shown in Python Shell.








NOTE : By default, Python program files have .py as file extension.


Comments

Popular posts from this blog

JavaScript Array Methods

JavaScript Arrays JavaScript arrays are used to store multiple values in a single variable. Displaying Arrays In this tutorial we will use a script to display arrays inside a <p> element with id="demo": Example < p  id= "demo" > < /p > < script > var cars = ["Saab", "Volvo", "BMW"]; document.getElementById("demo").innerHTML = cars; < /script > The first line (in the script) creates an array named cars. The second line "finds" the element with id="demo", and "displays" the array in the "innerHTML" of it. Example var cars = ["Saab", "Volvo", "BMW"]; Spaces and line breaks are not important. A declaration can span multiple lines: Example var cars = [     "Saab",     "Volvo",     "BMW" ]; Never put a comma after the last element (like &