PHYTON
What is Python ?
◦ Python is a simple, easy to learn, powerful, high level and object-
◦ oriented programming language.
◦ Python is an interpreted scripting language also. Guido Van Rossum is known as the founder of python
programming.
◦ Introduction to Python
◦ It covers the topics such as python programming, features, history, versions, how to install, example, how to
execute, variables, keywords, identifiers, literals, operators and comments.
Control Statement
The control statement in python covers if
statement, for loop, while loop, do while loop,
break statement, continue statement and
pass statement.
Python Strings
The string chapter in python provides the full
functionality to work on strings such as accessing
string, applying string operators, details of slice
notation, applying different functions etc.
Python Tuples
A sequence of immutable objects is known as tuple, it covers accessing
tuple, adding tuple, replicating tuple, updating tuple etc.
Python Dictionary
The python dictionary provides details about dictionary operations.
Python Functions
It provides a list of python functions with its implementations.
Python Files I/O
How to write data into file and read data from file in python?
Python Modules
What is python module? What are the usage of modules?
Python Exceptions
It explains the errors and exceptions in python.
• Python Introduction
• Python is a general purpose, dynamic, high level and interpreted
programming language. It supports Object Oriented programming
approach to develop applications. It is simple and easy to learn
and provides lots of high-level data structures.
• Python is easy to learn yet powerful and versatile scripting
language which makes it attractive for Application Development.
• Python's syntax and dynamic typing with its interpreted nature,
makes it an ideal language for scripting and rapid application
development.
• Python supports multiple programming pattern, including object
oriented, imperative and functional or procedural programming
styles.
Python
Features
1) Easy to Learn and Use
Python is easy to learn and use. It is developer-friendly and high level programming
language.
2) Expressive Language
Python language is more expressive means that it is more understandable and
readable.
3) Interpreted Language
Python is an interpreted language i.e. interpreter executes the code line by line at a time.
This makes debugging easy and thus suitable for beginners.
4) Cross-platform Language
Python can run equally on different platforms such as Windows, Linux, Unix and
Macintosh
etc. So, we can say that Python is a portable language.
5) Free and Open Source
Python language is freely available at offical web address.The source-code is also available.
Python is not intended to work on special area such as
web programming. That is why it is known
as multipurpose because it can be used with web,
enterprise, 3D CAD etc.
We don't need to use data types to declare variable
because it is dynamically typed so we can write a=10 to
assign an integer value in an integer variable.
Python makes the development and
debugging fast because there is no compilation step
included in python development and edit-test-debug
cycle is very fast.
6) Object-Oriented Language
Python supports object oriented language and concepts of classes
and objects come into existence.
7)Extensible
It implies that other languages such as C/C++ can be used to
compile
the code and thus it can be used further in our python code.
8) Large Standard Library
Python has a large and broad library and provides rich set of module
and functions for rapid application development.
9) GUI Programming Support
Graphical user interfaces can be developed using Python.
10) Integrated
It can be easily integrated with languages like C, C++, JAVA etc.
Python
History
Python laid its foundation in the late 1980s.
The implementation of Python was started in the December 1989 by Guido Van
Rossum at CWI in Netherland.
In February 1991, van Rossum published the code (labeled version 0.9.0) to
alt.sources.
In 1994, Python 1.0 was released with new features like: lambda, map, filter, and
reduce.
Python 2.0 added new features like: list comprehensions, garbage collection
system.
On December 3, 2008, Python 3.0 (also called "Py3K") was released. It was
designed to rectify fundamental flaw of the language.
ABC programming language is said to be the predecessor of Python language
which was capable of Exception HC
o
ap
ni
e
dd -
lP
ir
no
f
g. M
aa
nu
l
i
dk B
io
nr
s
ta
en
i
y
ra
facing with Amoeba
Operating
Python Version
Python Application Area
1) Web Applications
2) Desktop GUI Applications
3) Software Development
4) Scientific and Numeric
5) Business Applications
6) Console Based Application
7) Audio or Video based Applications
8) 3D CAD Applications
9) Enterprise Applications
10) Applications for Images
Simple Demo Program
• print("hello world by python!")
Execute this example by using following
command.
Python hello.py
• OR
>>> a="Welcome To Python"
>>> print a
Welcome To Python
S
Simple Variable
Declaration
Variable Declaration
x=5……………..(1)
X=y=z=50…………….(2)
a,b,c=5,10,15……………..(3)
Tokens
• Tokens can be defined as a punctuator mark,
reserved words and each individual word in a
statement.
• Token is the smallest unit inside the given
program.
• There are following tokens in Python:
• Keywords.
• Identifiers.
• Literals.
• Operators.
Tuples
Tuple is another form of collection where different type
of data can be stored.
It is similar to list where data is separated by commas.
Only the difference is that list uses square bracket and
tuple uses parenthesis.
Tuples are enclosed in parenthesis and cannot be
changed.
>>> tuple=('rahul',100,60.4,'deepak')
>>> tuple1=('sanjay',10)
>>> tuple ('rahul', 100, 60.4, 'deepak')
>>> tuple[2:] (60.4, 'deepak')
>>> tuple1[0] 'sanjay'
>>> tuple+tuple1 ('rahul', 100, 60.4, 'deepak', 'sanjay', 10)
Dictionary
Dictionary is a collection which works on a key-value pair.
It works like an associated array where no two keys can be same.
Dictionaries are enclosed by curly braces ({}) and values can be
retrieved by square bracket([]).
>>> dictionary={'name':'charlie','id':100,'dept':'it'}
>>> dictionary {'dept': 'it', 'name': 'charlie', 'id': 100}
>>> dictionary.keys()
['dept', 'name', 'id']
>>> dictionary.values() ['it', 'charlie',
100]
Python Keywords
List
List contain items of different data types. Lists are mutable i.e.,
modifiable.
The values stored in List are separated by commas(,) and enclosed
within a square brackets([]). We can store different type of data in a
List.
Value stored in a List can be retrieved using the slice operator([] and
[:]).
The plus sign (+) is the list concatenation and asterisk(*) is the
repetition operator.
>>> list=[‘Maulik',678,20.4,‘Ravi']
>>> list1=[456,‘Kalpesh']
list ['aman', 678, 20.4, 'saurav
>>> list+list1
Operator
Operators are particular symbols that are used to perform operations on
operands. It returns result that can be used in application.
Arithmetic Operators.
Relational Operators.
Assignment Operators.
Logical Operators.
Membership Operators.
Identity Operators.
Bitwise Operators.
Conditional Statement
Copied -Prof. Maulik Borsaniya
year=2000
if year%4==0:
print "Year is Leap"
else:
print "Year is not
Leap"

pengenalan python apa itu python untuk apa.pptx

  • 1.
  • 2.
    What is Python? ◦ Python is a simple, easy to learn, powerful, high level and object- ◦ oriented programming language. ◦ Python is an interpreted scripting language also. Guido Van Rossum is known as the founder of python programming. ◦ Introduction to Python ◦ It covers the topics such as python programming, features, history, versions, how to install, example, how to execute, variables, keywords, identifiers, literals, operators and comments.
  • 3.
    Control Statement The controlstatement in python covers if statement, for loop, while loop, do while loop, break statement, continue statement and pass statement. Python Strings The string chapter in python provides the full functionality to work on strings such as accessing string, applying string operators, details of slice notation, applying different functions etc.
  • 4.
    Python Tuples A sequenceof immutable objects is known as tuple, it covers accessing tuple, adding tuple, replicating tuple, updating tuple etc. Python Dictionary The python dictionary provides details about dictionary operations. Python Functions It provides a list of python functions with its implementations. Python Files I/O How to write data into file and read data from file in python? Python Modules What is python module? What are the usage of modules? Python Exceptions It explains the errors and exceptions in python.
  • 5.
    • Python Introduction •Python is a general purpose, dynamic, high level and interpreted programming language. It supports Object Oriented programming approach to develop applications. It is simple and easy to learn and provides lots of high-level data structures. • Python is easy to learn yet powerful and versatile scripting language which makes it attractive for Application Development. • Python's syntax and dynamic typing with its interpreted nature, makes it an ideal language for scripting and rapid application development. • Python supports multiple programming pattern, including object oriented, imperative and functional or procedural programming styles.
  • 6.
    Python Features 1) Easy toLearn and Use Python is easy to learn and use. It is developer-friendly and high level programming language. 2) Expressive Language Python language is more expressive means that it is more understandable and readable. 3) Interpreted Language Python is an interpreted language i.e. interpreter executes the code line by line at a time. This makes debugging easy and thus suitable for beginners. 4) Cross-platform Language Python can run equally on different platforms such as Windows, Linux, Unix and Macintosh etc. So, we can say that Python is a portable language. 5) Free and Open Source Python language is freely available at offical web address.The source-code is also available.
  • 7.
    Python is notintended to work on special area such as web programming. That is why it is known as multipurpose because it can be used with web, enterprise, 3D CAD etc. We don't need to use data types to declare variable because it is dynamically typed so we can write a=10 to assign an integer value in an integer variable. Python makes the development and debugging fast because there is no compilation step included in python development and edit-test-debug cycle is very fast.
  • 8.
    6) Object-Oriented Language Pythonsupports object oriented language and concepts of classes and objects come into existence. 7)Extensible It implies that other languages such as C/C++ can be used to compile the code and thus it can be used further in our python code. 8) Large Standard Library Python has a large and broad library and provides rich set of module and functions for rapid application development. 9) GUI Programming Support Graphical user interfaces can be developed using Python. 10) Integrated It can be easily integrated with languages like C, C++, JAVA etc.
  • 9.
    Python History Python laid itsfoundation in the late 1980s. The implementation of Python was started in the December 1989 by Guido Van Rossum at CWI in Netherland. In February 1991, van Rossum published the code (labeled version 0.9.0) to alt.sources. In 1994, Python 1.0 was released with new features like: lambda, map, filter, and reduce. Python 2.0 added new features like: list comprehensions, garbage collection system. On December 3, 2008, Python 3.0 (also called "Py3K") was released. It was designed to rectify fundamental flaw of the language. ABC programming language is said to be the predecessor of Python language which was capable of Exception HC o ap ni e dd - lP ir no f g. M aa nu l i dk B io nr s ta en i y ra facing with Amoeba Operating
  • 10.
  • 12.
    Python Application Area 1)Web Applications 2) Desktop GUI Applications 3) Software Development 4) Scientific and Numeric 5) Business Applications 6) Console Based Application 7) Audio or Video based Applications 8) 3D CAD Applications 9) Enterprise Applications 10) Applications for Images
  • 13.
    Simple Demo Program •print("hello world by python!") Execute this example by using following command. Python hello.py • OR >>> a="Welcome To Python" >>> print a Welcome To Python
  • 14.
  • 15.
  • 16.
    Tokens • Tokens canbe defined as a punctuator mark, reserved words and each individual word in a statement. • Token is the smallest unit inside the given program. • There are following tokens in Python: • Keywords. • Identifiers. • Literals. • Operators.
  • 17.
    Tuples Tuple is anotherform of collection where different type of data can be stored. It is similar to list where data is separated by commas. Only the difference is that list uses square bracket and tuple uses parenthesis. Tuples are enclosed in parenthesis and cannot be changed.
  • 18.
    >>> tuple=('rahul',100,60.4,'deepak') >>> tuple1=('sanjay',10) >>>tuple ('rahul', 100, 60.4, 'deepak') >>> tuple[2:] (60.4, 'deepak') >>> tuple1[0] 'sanjay' >>> tuple+tuple1 ('rahul', 100, 60.4, 'deepak', 'sanjay', 10)
  • 19.
    Dictionary Dictionary is acollection which works on a key-value pair. It works like an associated array where no two keys can be same. Dictionaries are enclosed by curly braces ({}) and values can be retrieved by square bracket([]). >>> dictionary={'name':'charlie','id':100,'dept':'it'} >>> dictionary {'dept': 'it', 'name': 'charlie', 'id': 100} >>> dictionary.keys() ['dept', 'name', 'id'] >>> dictionary.values() ['it', 'charlie', 100]
  • 20.
  • 21.
    List List contain itemsof different data types. Lists are mutable i.e., modifiable. The values stored in List are separated by commas(,) and enclosed within a square brackets([]). We can store different type of data in a List. Value stored in a List can be retrieved using the slice operator([] and [:]). The plus sign (+) is the list concatenation and asterisk(*) is the repetition operator.
  • 22.
  • 23.
    Operator Operators are particularsymbols that are used to perform operations on operands. It returns result that can be used in application. Arithmetic Operators. Relational Operators. Assignment Operators. Logical Operators. Membership Operators. Identity Operators. Bitwise Operators.
  • 26.
  • 27.
    Copied -Prof. MaulikBorsaniya year=2000 if year%4==0: print "Year is Leap" else: print "Year is not Leap"