Python is a high-level, interpreted programming language that emphasizes readability and simplicity, making it an excellent choice for beginners and experienced developers alike. Here's a brief overview of Python's key features:
2. What is Python..?
• Python is a general purpose programming language
that is often applied in scripting roles.
• So, Python is programming language as well as
scripting language.
• Python is also called as Interpreted language
3. Difference Between Program and scripting language
Program
• A program is executed (i.e. the
source is first compiled, and the
result of that compilation is
expected)
• A program in general, is a sequence
of instructions written so that a
computer can perform certain task.
Scripting
• A script is interpreted.
• A script is code written in a scripting
language. A scripting language is
nothing but a type of programming
language in which we can write code
to control another software
application.
4. History
• Invented in the Netherlands, early
90s by Guido van Rossum.
• Python was conceived in the late
1980s and its implementation was
started in December 1989.
• Guido Van Rossum is fan of ‘Monty
Python’s Flying Circus’, this is a
famous TV show in Netherlands.
• Named after Monty Python.
• Open sourced from the beginning.
6. What can I do with Python…?
• System
programming.
• Graphical User
Interface
Programming
• Internet Scripting
• Component
Integration
• Database
Programming
• Gaming, Images,
XML , Robot and
more.
7. Why do
people
use
Python?
The following primary factors cited by Python users seem to be these:
Python is object-oriented
Structure supports such concepts as polymorphism,
operation overloading, and multiple inheritance.
It's free (open source)
Downloading and installing Python is free and easy Source
code is easily accessible.
It's powerful
- Dynamic typing
- Built-in types and tools
- Library utilities
- Third party utilities (e.g. Numeric, NumPy, SciPy)
- Automatic memory management
It's portable
- Python runs virtually every major platform used today
- As long as you have a compatible Python interpreter
installed, Python programs will run in exactly the same
manner, irrespective of platform.
8. Enough to Understand the Code
Indentation matters to code meaning
- Block structure indicated by indentation
First assignment to a variable creates it
- Variable types don’t need to be declared.
- Python figures out the variable types on its own.
Assignment is = and comparison is ==
For numbers + - * / % are as expected
- Special use of + for string concatenation and % for string formatting (as in C’s printf)
Logical operators are words (and, or, not) not symbols.
The basic printing command is print
9. Python Code Execution
Python’s traditional runtime
execution model: source code you
type is translated to byte code,
which is then run by the Python
Virtual Machine. Your code is
automatically compiled, but then
it is interpreted.
Source code extension is .py
Byte code extension is .pyc
(compiled python code)
10. Running Python
Once you're inside the Python interpreter, type in
commands at will.
Examples:
>>> print 'Hello world’
Hello world
# Relevant output is displayed on subsequent lines
without the >>> symbol
>>> x = [0,1,2]
# Quantities stored in memory are not displayed by
default
>>> x
# If a quantity is stored in memory, typing its name
will display it [0,1,2]
>>> 2+3
5
11. A Sample Code
X= 34-23 #A comment.
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