Python – Introduction to Python Programming Language



Python – Introduction to Python Programming Language

0 0


pythontutorial

Repository for Best Python Tutorial Slides

On Github gdbhosale / pythontutorial

Python

Introduction to Python Programming Language

Created by Dwij IT Solutions / Ganesh Bhosale

Hello There

Python is a widely used general-purpose, high-level programming language that lets you work more quickly and integrate your systems more effectively.

Its design philosophy emphasises code readability, and its syntax allows programmers to express concepts in fewer lines of code

History of Python

Python was conceived in the late 1980’s and its implementation was started in December 1989 by Guido van Rossum in the Netherlands.

Features of Python Language

  • Very clear, readable syntax
  • Object orientation
  • Natural expression of procedural code
  • Full modularity, supporting hierarchical packages
  • Exception-based error handling
  • Very high level dynamic data types
  • Extensive standard libraries and third party modules for virtually every task
  • Extensions and modules easily written in C, C++, Java

Core Philosophy

Python facts !!!

  • Open Source
  • Easy to Learn & excel.
  • No need of compilation of code.
  • Error handling in runtime.
  • Take very less time for up & running.
  • Object Oriented Programming + Procedural + Functional
  • Pre-installed with Linux, Unix & Mac OSX

Up & running with Python

Python Installation on Ubuntu

By default python comes pre-installed in Ubuntu distribution. Check simply by command:

python --version

Python Installation on Windows

Donwload Python Installer from https://www.python.org/downloads/windows. Or use direct Donwload link for python-2.7.5 If python get installed in C:\python27 directory, use command to set path:
set path=%path%;C:\python27
You will see Python (command line) in Windows Menu. Make sure it runs and opens Python Shell Window

Python Installation on Macintosh

The latest version of Mac OS X, Yosemite, comes with Python 2.7 out of the box. Check simply by command:

python --version

If not you can install it from https://www.python.org/downloads/mac-osx

Python Interpreter

Simply by putting command python in terminal you can start python interpretor for Ubuntu/Mac. For windows open Python (command line) from Windows Menu.

The interpreter’s line-editing features include interactive editing, history substitution and code completion on systems that support readline.

The interpreter operates somewhat like the Unix shell: when called with standard input connected to a tty device, it reads and executes commands interactively.

Using Interpreter

Press to get command history. When commands are read from a tty, the interpreter is said to be in interactive mode. In this mode it prompts for the next command with the secondary prompt which has three dots representation (...), instead of (>>>) which is primary prompt. To exit interpreter: Use Ctrl+D in Linux & Mac Use Ctrl+Z and then Enter in Windows

Using Interpreter

>>>(7+2)*10
90
>>>print “Hello World”
Hello World
>>>i=90
>>>i
90
>>>print i*(i+10)
9000

Running Python Files (.py)

  • Off course you are not going to write all your python codes on interpreter.
  • We use extension .py for saving python files.
  • Command to execute python file:
python SimpleProgram.py
Let’s see How to write programs in Python !!!

SimpleProgram.py

x = 34 - 23 # Acomment.
y = "Hello" # Another one.
z = 3.45
if z == 3.45 or y == "Hello":
	x = x + 1
	y = y + "World" # String concat.
print x
print y

Basics of Python

References

Thank you

- Dwij IT Solutions - Ganesh Bhosale

Python Introduction to Python Programming Language Created by Dwij IT Solutions / Ganesh Bhosale