SlideShare une entreprise Scribd logo
1  sur  74
Introduction to
By:
JanBaskTraining.com
Intro. ToPython 2of 75JanBask Training
Contents at a Glance
• What is Python?
• History and Timeline
• Python 2 and 3
• Philosophy
• Key Features
• Paradigms
• Popularity
• Getting Started
• IDLE IDE
• First Program
• Other IDEs
• Python Basics
• Variables and Data Types
• Operators
• Type Conversion
• Syntax and Structures
• Input / Output
• Identifiers
• lines
• Block and Indentation
• Quotations
• Comments
Intro. ToPython 3of 75
Contents at a Glance
• Control Flow
• Composite Types
• Lists
• Tuples
• Ranges
• Dictionaries
• Functions
• Definitions and Calling
• Nested Functions
• First-Class Objects
• Object-Oriented Python
• Classes
• Inheritance
• Garbage Collection
• Be Pythonic!
• Summary
• References
JanBask Training
What isPython?
• Python is a widely-used general purpose
(both industry and academia) high-level
Programming language.
• It combines the power of systems
languages, such as C and Java, with the
ease and rapid development of scripting
languages, such as Ruby.
Intro. ToPython 4of 75JanBask Training
History andTimeline
• Python Invented by Guido van Rossum
in1991 at CWI in the Netherlands.
• Python reached version 1.0 in January
1994. The major new features included in
this release were the functional
programming tools.
Van Rossum
Born: 31 January 1956 (age 58)
Intro. ToPython 5of 75JanBask Training
Intro. ToPython 6of 75
History andTimeline
• Python 1.0 - January 1994
• Python 1.5 - December 31, 1997
• Python 1.6 - September 5, 2000
• Python 2.0 - October 16, 2000
• Python 2.1 - April 17, 2001
• Python 2.2 - December 21, 2001
• Python 2.3 - July 29, 2003
• Python 2.4 - November 30, 2004
• Python 2.5 - September 19, 2006
• Python 2.6 - October 1, 2008
• Python 2.7 - July 3, 2010
• Python 3.0 - December 3, 2008
• Python 3.1 - June 27, 2009
• Python 3.2 - February 20, 2011
• Python 3.3 - September 29, 2012
• Python 3.4 - March 16, 2014
JanBask Training
Intro. ToPython 7of 75
Python 2 and 3
• Python 2.0 was released in 2000, with many new features
added.
• Python 3.0, adjusting several aspects of the core
language, was released in 2008.
• Python 3.0 is backwards-incompatible.
• Codes written for Python 2.x may not work under 3.x!
• Python 2.x is legacy, Python 3.x is the present and future of the
language.
JanBask Training
Intro. ToPython 8of 75
Language Philosophy
• Beautiful is better than ugly
• Explicit is better than implicit
• Simple is better than complex
• Complex is better than complicated
• Flat is better than nested
• Sparse is better than dense
JanBask Training
Intro. ToPython 9of 75
Key Features
• Simple and Minimalistic
• Easy to Learn
• High-level Language
• Portable
• Interpreted
• Embeddable
• Extensive Libraries
• Free, Open Source, … and Fun!
JanBask Training
Intro. ToPython 10of 75
Programming Paradigms
• Python is a multi paradigm programming language.
• Imperative
• Functional
• Object-Oriented
• Aspect-Oriented
• Logic (rule base) Programming (by extension)
• …
JanBask Training
Intro. ToPython 11of 75
• Top 10
Programming
Languages.
• IEEE Spectrum’s
2014 Ranking.
Popularity
Infographic:
Brandon Palacio
http://spectrum.ieee.org
Intro. ToPython 12of 75[JanBaskTraining]
Intro. ToPython 13of 75[JanBaskTraining]
Getting Started
• There are three different ways to start Python
1. Interactive Interpreter
• from Unix, Linux, DOS, etc.
• Python shell begin with >>>
2. Script from the Command-line
• Install python.
• python [YourScriptFileName.py]
3. Integrated Development Environment (IDE)
• You can run Python from a graphical user interface (GUI) environment.
• All in One solution like IDLE in next slide.
Getting Started
• IDLE IDE
• Download Python from
http://python.org
• Install it.
• Run it.
Intro. ToPython 14of 75[JanBaskTraining]
Python Shell
Intro. ToPython 15of 75[JanBaskTraining]
Simple Script with Output
Intro. ToPython 16of 75[JanBaskTraining]
Other IDEs:PyDev
• PyDev is a Python
IDE for Eclipse
• http://pydev.org/
Intro. ToPython 17of 75[JanBaskTraining]
Other IDEs: Visual Studio
Intro. ToPython 18of 75[JanBaskTraining]
Intro. ToPython 19of 75[JanBaskTraining]
Python Basics: Objects and Variables
• In python everything is an object.
• So a variable is an object.
• A variable is name given to a memory location to store
value in the computer’s main storage.
Intro. ToPython 20of 75[JanBaskTraining]
Python Basics: Objects and Variables
• Every object / Variable has three components:
1. Identity
• Object’s address in memory does not change once it has been created.
2. Type (or Class)
• A set of values and the allowable operations on those values exist foreach type.
• Type of type is type!!!
3. Value
• To bind value to a variable using assignment operator ( = ), for example:
• x = 12345
Python Basics: Objects and Variables
• Python is a dynamically typed language, so:
• Use Late Binding (run time binding).
• No need to declare variable before binding a value.
• Any given variable can have its value altered at any time!
Intro. ToPython 21of 75[JanBaskTraining]
Primitive DataTypes
• Python has some standard types that are used to define the
operations possible on them and the storage method for each
of them.
Intro. ToPython 22of 75[JanBaskTraining]
Primitive DataTypes
Intro. ToPython 23of 75[JanBaskTraining]
Intro. ToPython 24of 75[JanBaskTraining]
Operators
• Basic Operators
• Arithmetic (+, - , *, /, %, //, **)
• Assignment (=, +=, -=, *=, /=, %=, //= ,**= )
• Comparison (<, >, <=, >=, ==, !=)
• Logical (and, or, not)
• Notes:
• + on strings does string concatenation
• * on (string * int) repeats string
Operators
Intro. ToPython 25of 75[JanBaskTraining]
Type Conversion
• Python has strong typing language (unlike JavaScript)
• We need to use type converter functions:
Intro. ToPython 26of 75[JanBaskTraining]
Syntax and Semantic: Simplicity
• Python syntax is simple, simple, simple!!!
• Full python grammar (BNF) is less than 120 line!
• There are less than 35 keywords in python.
Intro. ToPython 27of 75[JanBaskTraining]
Syntax and Semantic: Powerfully
SimpleSwapinJava: SimpleSwapinPython:
Intro. ToPython 28of 75[JanBaskTraining]
Input andOutput
Script tocalculate circle area: Output:
Intro. ToPython 29of 75[JanBaskTraining]
Intro. ToPython 30of 75[JanBaskTraining]
Identifiers
• A Python identifier is a name used to identify a variable,
function, class, module, or other object.
• An identifier starts with a letter A to Z or a to z or an
underscore (_) followed by zero or more letters,
underscores, and digits (0 to 9).
• Python does not allow punctuation characters such as @,
$, and % within identifiers.
• Python is a case sensitive programming language. Thus
Var and var are two different identifiers in Python.
Lines
• Single-Line Statements
• Statements in Python typically end with a new line.
• Multi-Line Statements
• character ‘’ use to denote that the line should continue.
Intro. ToPython 31of 75[JanBaskTraining]
Lines
• Statements contained within the [ ], { }, or ( ) brackets do not
need to use the line continuation character. For example:
• line containing only whitespace, possibly with a comment, is
known as a blank line, and Python totally ignores it.
Intro. ToPython 32of 75[JanBaskTraining]
Lines
• Multiple Statements on a Single Line
• The semicolon ( ; ) allows multiple statements on the single line.
• Multiple Statement Groups called Suites
• Groups of individual statements making up a single code block are
called suites.
• Compound or complex statements, such as “if”, “while”, “def”, and
“class”, are those which require a header line and a suite.
Intro. ToPython 33of 75[JanBaskTraining]
Intro. ToPython 34of 75[JanBaskTraining]
Blocks andIndentations
• Blocks begin with colon mark ( : )
• Nested blocks are allowed.
• Line Indentation use to determine blocks scope!
• The number of spaces in the indentation is variable, but all
statements within the block must be indented the same amount
• pass keyword use to fill empty or not implementation
blocks body.
• pass ≡ do nothing
Quotations
• Python accepts single ('), double (") and triple (''' or """)
quotes to denote string literals, as long as the same type of
quote starts and ends the string.
• The triple quotes can be used to span the string across
multiple lines.
Intro. ToPython 35of 75[JanBaskTraining]
Comments
• A hash sign (#) that is not inside a string literal begins a
comment.
• All characters after the # and up to the physical line end are
part of the comment, and the Python interpreter ignores
them.
Intro. ToPython 36of 75[JanBaskTraining]
Control Flow:Conditions
• Like other languages, Python has if and else statements
• Python’s “else-if” is spelled elif
Intro. ToPython 37of 75[JanBaskTraining]
Control Flow:Conditions
• Python has an easy to use if-syntax for setting the value of
a variable!
Intro. ToPython 38of 75[JanBaskTraining]
Intro. ToPython 39of 75[JanBaskTraining]
Truth and Falsity Value Testing
• Any object can be tested for truth value, for use in a
condition.
• False:
1. None (≡ 𝑛𝑢𝑙𝑙)
2. False (Python >= 2.2.1)
3. Zero of any numeric type, e.g., 0, 0.0, 0j
4. Any empty sequence or dictionary, e.g., ‘ ‘, ( ), [ ], { }
• True:
• Everything else
Control Flow:Loops
• While loop
• The while loop continues to execute the same body of code until
the conditional statement is no longer True.
• We can use break and continue inside the loops
Intro. ToPython 40of 75[JanBaskTraining]
Control Flow:Loops
• For loop
• The for loop in Python is much simpler that other C-like
languages.
• We can use range() function to produce a list of numbers.
Intro. ToPython 41of 75[JanBaskTraining]
Intro. ToPython 42of 75[JanBaskTraining]
Sequence Types
• There are three basic sequence types:
• lists
• Tuples
• range objects
• Additional sequence types include:
• Strings (str)
• Binary Data (bytes, bytearray, memoryview)
Intro. ToPython 43of 75[JanBaskTraining]
Sequence Types
• Sequence types are very like together.
• All of them consist of iterables objects.
• There are some difference:
• Lists are mutable, heterogeneous.
• Tuple are immutable, heterogeneous.
• Ranges are immutable, homogeneous.
• String are immutable, homogeneous.
• Immutable ≡ 𝐶𝑎𝑛′ 𝑡 𝑢𝑠𝑒 𝑎𝑠 𝑙 − 𝑣𝑎𝑙𝑢𝑒
Intro. ToPython 44of 75[JanBaskTraining]
Lists
• Lists are similar to arrays in C. One difference between
them is that all the items belonging to a list can be of
different data type.
• [] – an empty list.
• [6] – an one-element list.
• [5, 1+2j, ’hello’] - a 3-element list (heterogeneous).
• [[1,2], [3,4], [5,6]] - a list of lists.
Intro. ToPython 45of 75[JanBaskTraining]
Lists
• Lists may be constructed in several ways:
• Using a pair of square brackets to denote the empty list:
• L = []
• Using square brackets, separating items with commas:
• L = [a] or L = [a, b, c]
• Using a list comprehension:
• L = [x for x in iterable]
• Using the type constructor:
• L = list() or L = list(iterable)
list comprehension
• A compact way to process all or part of the elements in a
sequence and return a list with the results.
• result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]
• generates a list of strings containing even hex numbers (0x..) in the
range from 0 to 255.
• The if clause is optional. If omitted, all elements in range(256) are
processed.
Intro. ToPython 46of 75[JanBaskTraining]
Intro. ToPython 47of 75[JanBaskTraining]
Tuples
• A tuple is another sequence data type that is similar to the
list.
• A tuple consists of a number of values separated by
commas.
• The main differences between lists and tuples are:
• Lists are enclosed in brackets ( [ ] ), and their elements and size can
be changed, while tuples are enclosed in parentheses ( ( ) ) and
cannot be updated.
• Tuples can be thought of as read-only lists.
Intro. ToPython 48of 75[JanBaskTraining]
Tuples
• Tuples may be constructed in a number of ways:
• Using a pair of parentheses to denote the empty tuple:
• T = ()
• Using a trailing comma for a singleton tuple:
• T= 1, or T = (1,)
• Separating items with commas:
• a, b, c or (a, b, c)
• Using the tuple() built-in:
• T = tuple() or T = tuple(iterable)
Intro. ToPython 49of 75[JanBaskTraining]
Ranges
• The range type represents an immutable sequence of
numbers and is commonly used for looping a specific
number of times in for loops.
• The advantage of the range type over a regular list or tuple is
that a range object will always take the same (small) amount of
memory, no matter the size of the range it represents (as it only
stores the start, stop and step values, calculating individual
items and subranges as needed).
Ranges
Intro. ToPython 50of 75[JanBaskTraining]
Common SequenceOperations
Intro. ToPython 51of 75[JanBaskTraining]
Intro. ToPython 52of 75[JanBaskTraining]
Dictionaries
• Python's dictionaries are hash table type. They work like
associative arrays in Perl and consist of key-value pairs.
• Keys can be almost any Python type, but are usually numbers or
strings. Values, on the other hand, can be any arbitrary Python
object.
• Dictionaries are enclosed by curly braces ( { } ) and values can be
assigned and accessed using square braces ( [] ).
• Dictionaries have no concept of order among elements. It is
incorrect to say that the elements are “out of order”; they are
simply unordered.
Dictionaries
Intro. ToPython 53of 75[JanBaskTraining]
Intro. ToPython 54of 75[JanBaskTraining]
Functions
• Function objects are created by function definitions. The
only operation on a function object is to call it:
• function-name(argument-list).
• There are really two flavors of function objects:
• built-in functions
• user-defined functions.
• Both support the same operation (to call the function), but the
implementation is different, hence the different object types.
Intro. ToPython 55of 75[JanBaskTraining]
Methods
• Method is a function defined in a class namespace.
• There are two flavors:
• built-in methods (such as append() on lists)
• class instance methods.
• Built-in methods are described with the types that support
them.
Intro. ToPython 56of 75[JanBaskTraining]
Define Functions
• Function blocks begin with the keyword def followed by the
function name and parentheses.
• The first statement of a function can be an optional statement
- the documentation string of the function or docstring.
• The code block within every function starts with a colon ( : )
and is indented.
• The statement return [expression] exits a function, optionally
passing back an expression to the caller. A return statement with
no arguments is the same as return None.
Define Functions
Intro. ToPython 57of 75[JanBaskTraining]
Intro. ToPython 58of 75[JanBaskTraining]
Arguments Passing
• Pass by reference vs value
• All parameters (arguments) in the Python language are passed
by reference.
• If you change what a parameter refers to within a function, the
change also reflects back in the calling function.
• If you assigned new value to parameter by assign operation (=),
new reference will be created (call by value!!!)
• So python provide two semantic by one syntax in function
calling!!!
Arguments Passing
Intro. ToPython 59of 75[JanBaskTraining]
Arguments Passing
Intro. ToPython 60of 75[JanBaskTraining]
Intro. ToPython 61of 75[JanBaskTraining]
Arguments Types
• You can call a function by using the following types of
formal arguments:
• Required arguments
• Keyword arguments
• Default arguments
• Variable-length arguments
Arguments Types
Intro. ToPython 62of 75[JanBaskTraining]
Intro. ToPython 63of 75[JanBaskTraining]
Nested Functions
• Function scopes (and class scopes) can be nested.
• Python using static scope.
• Inner function can’t access to variables reference exist in
outer function but R-Value allowed!
• nonlocal keyword use to access outer variables so
dynamic scope will provide!!!
Nested Functions
Intro. ToPython 64of 75[JanBaskTraining]
First-Class Objects
• Almost everything (including functions, classes, etc) in
Python is a first-class object!
Intro. ToPython 65of 75[JanBaskTraining]
First-Class Objects
Intro. ToPython 66of 75[JanBaskTraining]
Object-Oriented Python
• Python support object-oriented (class and objects)
• Python support multiple inheritance
Intro. ToPython 67of 75[JanBaskTraining]
Object-Oriented Python
Intro. ToPython 68of 75[JanBaskTraining]
Intro. ToPython 69of 75[JanBaskTraining]
Destroying Objects (Garbage Collection)
• Allocating and freeing memory is not your problem!
• Python uses reference counting.
• An object's reference count increases when it's assigned a new
name or placed in a container (list, tuple, etc). The object's
reference count decreases when it's deleted with del.
• When an object's reference count reaches zero, Python
collects it automatically.
Be Pythonic!
Intro. ToPython 70of 75[JanBaskTraining]
Intro. ToPython 71of 75[JanBaskTraining]
Alternative PythonImplementations
• CPython: Traditional implementation of Python that we
used in this introduction.
• IronPython: Python running on .NET
• Jython: Python running on the Java Virtual Machine (JVM)
• PyPy: A fast python implementation with a just in-time (JIT)
compiler.
• More:
• https://www.python.org/download/alternatives
Intro. ToPython 72of 75[JanBaskTraining]
Famous Apps. written in python
• Dropbox: A web-based file hosting service
• BitTorrent: original client, along with several derivatives.
• Ubuntu Software Center: A graphical package manager,
installed by default in Ubuntu 9.10 and higher.
• More:
• http://en.wikipedia.org/wiki/List_of_Python_software
Summary
• Python is
• High-Level
• Multi-Paradigm
• and has
• Dynamic Type
• Strong Type
• and use
• Call by Reference(and value)
• Static (and Dynamic) Scope
Intro. ToPython 73of 75[JanBaskTraining]
Reference
1. Python Official Website
• http://python.org/
2. Python 3 Documentation
• http://docs.python.org/3/
3. Python Tutorials
• http://www.tutorialspoint.com/python/
74of 75

Contenu connexe

Tendances

Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Edureka!
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python amiable_indian
 
Python Fundamentals
Python FundamentalsPython Fundamentals
Python FundamentalsSherif Rasmy
 
Python Tutorial For Beginners | Python Crash Course - Python Programming Lang...
Python Tutorial For Beginners | Python Crash Course - Python Programming Lang...Python Tutorial For Beginners | Python Crash Course - Python Programming Lang...
Python Tutorial For Beginners | Python Crash Course - Python Programming Lang...Edureka!
 
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python Tutorial | Python Tutorial for Beginners | Python Training | EdurekaPython Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python Tutorial | Python Tutorial for Beginners | Python Training | EdurekaEdureka!
 
Python final presentation kirti ppt1
Python final presentation kirti ppt1Python final presentation kirti ppt1
Python final presentation kirti ppt1Kirti Verma
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming LanguageTahani Al-Manie
 
Data Analysis and Visualization using Python
Data Analysis and Visualization using PythonData Analysis and Visualization using Python
Data Analysis and Visualization using PythonChariza Pladin
 
Introduction To Python | Edureka
Introduction To Python | EdurekaIntroduction To Python | Edureka
Introduction To Python | EdurekaEdureka!
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An IntroductionSwarit Wadhe
 
Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function Kamlesh Makvana
 
Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...Simplilearn
 
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Pedro Rodrigues
 
What is Python? | Edureka
What is Python? | EdurekaWhat is Python? | Edureka
What is Python? | EdurekaEdureka!
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonNowell Strite
 
Python Basics | Python Tutorial | Edureka
Python Basics | Python Tutorial | EdurekaPython Basics | Python Tutorial | Edureka
Python Basics | Python Tutorial | EdurekaEdureka!
 

Tendances (20)

Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
Python Fundamentals
Python FundamentalsPython Fundamentals
Python Fundamentals
 
Python Basics
Python BasicsPython Basics
Python Basics
 
Python Tutorial For Beginners | Python Crash Course - Python Programming Lang...
Python Tutorial For Beginners | Python Crash Course - Python Programming Lang...Python Tutorial For Beginners | Python Crash Course - Python Programming Lang...
Python Tutorial For Beginners | Python Crash Course - Python Programming Lang...
 
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python Tutorial | Python Tutorial for Beginners | Python Training | EdurekaPython Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
 
Python final presentation kirti ppt1
Python final presentation kirti ppt1Python final presentation kirti ppt1
Python final presentation kirti ppt1
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming Language
 
Data Analysis and Visualization using Python
Data Analysis and Visualization using PythonData Analysis and Visualization using Python
Data Analysis and Visualization using Python
 
Introduction To Python | Edureka
Introduction To Python | EdurekaIntroduction To Python | Edureka
Introduction To Python | Edureka
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An Introduction
 
Python - the basics
Python - the basicsPython - the basics
Python - the basics
 
Introduction of python
Introduction of pythonIntroduction of python
Introduction of python
 
Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function
 
Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...
 
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)
 
What is Python? | Edureka
What is Python? | EdurekaWhat is Python? | Edureka
What is Python? | Edureka
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Python Basics | Python Tutorial | Edureka
Python Basics | Python Tutorial | EdurekaPython Basics | Python Tutorial | Edureka
Python Basics | Python Tutorial | Edureka
 

En vedette

En vedette (12)

Salesforce: The State of connected Patient 2015
Salesforce: The State of connected Patient 2015Salesforce: The State of connected Patient 2015
Salesforce: The State of connected Patient 2015
 
Python Hype?
Python Hype?Python Hype?
Python Hype?
 
Python for All
Python for All Python for All
Python for All
 
Introduction to Python for Data Science
Introduction to Python for Data ScienceIntroduction to Python for Data Science
Introduction to Python for Data Science
 
Dia da dependência de pescado
Dia da dependência de pescado Dia da dependência de pescado
Dia da dependência de pescado
 
Tâche 1 ppt
Tâche 1 pptTâche 1 ppt
Tâche 1 ppt
 
HR4: Firstbeatin Hyvinvointianalyysi henkilöstön kokonaisvaltaisen hyvinvoinn...
HR4: Firstbeatin Hyvinvointianalyysi henkilöstön kokonaisvaltaisen hyvinvoinn...HR4: Firstbeatin Hyvinvointianalyysi henkilöstön kokonaisvaltaisen hyvinvoinn...
HR4: Firstbeatin Hyvinvointianalyysi henkilöstön kokonaisvaltaisen hyvinvoinn...
 
โรคเอดส์
โรคเอดส์โรคเอดส์
โรคเอดส์
 
Characters ok
Characters okCharacters ok
Characters ok
 
Social media clark
Social media clarkSocial media clark
Social media clark
 
การคุมกำเนิด
การคุมกำเนิดการคุมกำเนิด
การคุมกำเนิด
 
KAUSHIK
KAUSHIKKAUSHIK
KAUSHIK
 

Similaire à Introduction about Python by JanBask Training

An Introduction to Python Programming
An Introduction to Python ProgrammingAn Introduction to Python Programming
An Introduction to Python ProgrammingMorteza Zakeri
 
What is Python?
What is Python?What is Python?
What is Python?PranavSB
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh MalothBhavsingh Maloth
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programmingChetan Giridhar
 
Python for katana
Python for katanaPython for katana
Python for katanakedar nath
 
Raspberry using Python Session 1
Raspberry using Python Session 1Raspberry using Python Session 1
Raspberry using Python Session 1Mohamed Abd Ela'al
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdfsamiwaris2
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1Ahmet Bulut
 
Python indroduction
Python indroductionPython indroduction
Python indroductionFEG
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptxGnanesh12
 
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdfPy-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdfshetoooelshitany74
 
prakash ppt (2).pdf
prakash ppt (2).pdfprakash ppt (2).pdf
prakash ppt (2).pdfShivamKS4
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfQ-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfMichpice
 

Similaire à Introduction about Python by JanBask Training (20)

An Introduction to Python Programming
An Introduction to Python ProgrammingAn Introduction to Python Programming
An Introduction to Python Programming
 
What is Python?
What is Python?What is Python?
What is Python?
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programming
 
Python for katana
Python for katanaPython for katana
Python for katana
 
Raspberry using Python Session 1
Raspberry using Python Session 1Raspberry using Python Session 1
Raspberry using Python Session 1
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdf
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1
 
Python intro
Python introPython intro
Python intro
 
Python indroduction
Python indroductionPython indroduction
Python indroduction
 
PYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdfPYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdf
 
Python 01.pptx
Python 01.pptxPython 01.pptx
Python 01.pptx
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
 
Python Programming 1.pptx
Python Programming 1.pptxPython Programming 1.pptx
Python Programming 1.pptx
 
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdfPy-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
 
prakash ppt (2).pdf
prakash ppt (2).pdfprakash ppt (2).pdf
prakash ppt (2).pdf
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfQ-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
 

Plus de JanBask Training

A Guide to Salesforce Certification Types
A Guide to Salesforce Certification TypesA Guide to Salesforce Certification Types
A Guide to Salesforce Certification TypesJanBask Training
 
What To Learn During The Lockdown?
What To Learn During The Lockdown?What To Learn During The Lockdown?
What To Learn During The Lockdown?JanBask Training
 
want to become a business analyst without it background
want to become a business analyst without it backgroundwant to become a business analyst without it background
want to become a business analyst without it backgroundJanBask Training
 
How to identify problem in data analysis
How to identify problem in data analysisHow to identify problem in data analysis
How to identify problem in data analysisJanBask Training
 
Become an Expert in Salesforce Apex Triggers | JanBask Training
 Become an Expert in Salesforce Apex Triggers | JanBask Training Become an Expert in Salesforce Apex Triggers | JanBask Training
Become an Expert in Salesforce Apex Triggers | JanBask TrainingJanBask Training
 
Top 15 reasons to choose qa testing as career
Top 15 reasons to choose qa testing as career Top 15 reasons to choose qa testing as career
Top 15 reasons to choose qa testing as career JanBask Training
 
Quick nine tips on how to become a business analyst for top management
Quick nine tips on how to become a business analyst for top managementQuick nine tips on how to become a business analyst for top management
Quick nine tips on how to become a business analyst for top managementJanBask Training
 
why DevOps Certification is essential for your professional growth
why DevOps Certification is essential for your professional growthwhy DevOps Certification is essential for your professional growth
why DevOps Certification is essential for your professional growthJanBask Training
 
What are some Real-Life Challenges of Big Data? | JanBask Training
What are some Real-Life Challenges of Big Data? | JanBask TrainingWhat are some Real-Life Challenges of Big Data? | JanBask Training
What are some Real-Life Challenges of Big Data? | JanBask TrainingJanBask Training
 
Growing Technology Trends in Education | JanBask Training
Growing Technology Trends in Education | JanBask TrainingGrowing Technology Trends in Education | JanBask Training
Growing Technology Trends in Education | JanBask TrainingJanBask Training
 
How to become a SQL Server DBA? | JanBask Training
How to become a SQL Server DBA? | JanBask TrainingHow to become a SQL Server DBA? | JanBask Training
How to become a SQL Server DBA? | JanBask TrainingJanBask Training
 
Best Language to Rely Upon For Developing Programs | JanBask Training
Best Language to Rely Upon For Developing Programs | JanBask TrainingBest Language to Rely Upon For Developing Programs | JanBask Training
Best Language to Rely Upon For Developing Programs | JanBask TrainingJanBask Training
 
Get started with hadoop hive hive ql languages
Get started with hadoop hive hive ql languagesGet started with hadoop hive hive ql languages
Get started with hadoop hive hive ql languagesJanBask Training
 
Top six benefits of aws certifications in 2019
Top six benefits of aws certifications in 2019Top six benefits of aws certifications in 2019
Top six benefits of aws certifications in 2019JanBask Training
 
What all things to consider for a good career in java
What all things to consider for a good career in javaWhat all things to consider for a good career in java
What all things to consider for a good career in javaJanBask Training
 
Know why you should take salesforce certifications
Know why you should take salesforce certificationsKnow why you should take salesforce certifications
Know why you should take salesforce certificationsJanBask Training
 
How to benefit from artificial intelligence machine learning in dev ops
How to benefit from artificial intelligence machine learning in dev opsHow to benefit from artificial intelligence machine learning in dev ops
How to benefit from artificial intelligence machine learning in dev opsJanBask Training
 
10 big data analytics tools to watch out for in 2019
10 big data analytics tools to watch out for in 201910 big data analytics tools to watch out for in 2019
10 big data analytics tools to watch out for in 2019JanBask Training
 
Become aws certified and get amazing job opportunities
Become aws certified and get amazing job opportunitiesBecome aws certified and get amazing job opportunities
Become aws certified and get amazing job opportunitiesJanBask Training
 
Top 10 job profiles for salesforce certified professionals
Top 10 job profiles for salesforce certified professionalsTop 10 job profiles for salesforce certified professionals
Top 10 job profiles for salesforce certified professionalsJanBask Training
 

Plus de JanBask Training (20)

A Guide to Salesforce Certification Types
A Guide to Salesforce Certification TypesA Guide to Salesforce Certification Types
A Guide to Salesforce Certification Types
 
What To Learn During The Lockdown?
What To Learn During The Lockdown?What To Learn During The Lockdown?
What To Learn During The Lockdown?
 
want to become a business analyst without it background
want to become a business analyst without it backgroundwant to become a business analyst without it background
want to become a business analyst without it background
 
How to identify problem in data analysis
How to identify problem in data analysisHow to identify problem in data analysis
How to identify problem in data analysis
 
Become an Expert in Salesforce Apex Triggers | JanBask Training
 Become an Expert in Salesforce Apex Triggers | JanBask Training Become an Expert in Salesforce Apex Triggers | JanBask Training
Become an Expert in Salesforce Apex Triggers | JanBask Training
 
Top 15 reasons to choose qa testing as career
Top 15 reasons to choose qa testing as career Top 15 reasons to choose qa testing as career
Top 15 reasons to choose qa testing as career
 
Quick nine tips on how to become a business analyst for top management
Quick nine tips on how to become a business analyst for top managementQuick nine tips on how to become a business analyst for top management
Quick nine tips on how to become a business analyst for top management
 
why DevOps Certification is essential for your professional growth
why DevOps Certification is essential for your professional growthwhy DevOps Certification is essential for your professional growth
why DevOps Certification is essential for your professional growth
 
What are some Real-Life Challenges of Big Data? | JanBask Training
What are some Real-Life Challenges of Big Data? | JanBask TrainingWhat are some Real-Life Challenges of Big Data? | JanBask Training
What are some Real-Life Challenges of Big Data? | JanBask Training
 
Growing Technology Trends in Education | JanBask Training
Growing Technology Trends in Education | JanBask TrainingGrowing Technology Trends in Education | JanBask Training
Growing Technology Trends in Education | JanBask Training
 
How to become a SQL Server DBA? | JanBask Training
How to become a SQL Server DBA? | JanBask TrainingHow to become a SQL Server DBA? | JanBask Training
How to become a SQL Server DBA? | JanBask Training
 
Best Language to Rely Upon For Developing Programs | JanBask Training
Best Language to Rely Upon For Developing Programs | JanBask TrainingBest Language to Rely Upon For Developing Programs | JanBask Training
Best Language to Rely Upon For Developing Programs | JanBask Training
 
Get started with hadoop hive hive ql languages
Get started with hadoop hive hive ql languagesGet started with hadoop hive hive ql languages
Get started with hadoop hive hive ql languages
 
Top six benefits of aws certifications in 2019
Top six benefits of aws certifications in 2019Top six benefits of aws certifications in 2019
Top six benefits of aws certifications in 2019
 
What all things to consider for a good career in java
What all things to consider for a good career in javaWhat all things to consider for a good career in java
What all things to consider for a good career in java
 
Know why you should take salesforce certifications
Know why you should take salesforce certificationsKnow why you should take salesforce certifications
Know why you should take salesforce certifications
 
How to benefit from artificial intelligence machine learning in dev ops
How to benefit from artificial intelligence machine learning in dev opsHow to benefit from artificial intelligence machine learning in dev ops
How to benefit from artificial intelligence machine learning in dev ops
 
10 big data analytics tools to watch out for in 2019
10 big data analytics tools to watch out for in 201910 big data analytics tools to watch out for in 2019
10 big data analytics tools to watch out for in 2019
 
Become aws certified and get amazing job opportunities
Become aws certified and get amazing job opportunitiesBecome aws certified and get amazing job opportunities
Become aws certified and get amazing job opportunities
 
Top 10 job profiles for salesforce certified professionals
Top 10 job profiles for salesforce certified professionalsTop 10 job profiles for salesforce certified professionals
Top 10 job profiles for salesforce certified professionals
 

Dernier

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 

Dernier (20)

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 

Introduction about Python by JanBask Training

  • 2. Intro. ToPython 2of 75JanBask Training Contents at a Glance • What is Python? • History and Timeline • Python 2 and 3 • Philosophy • Key Features • Paradigms • Popularity • Getting Started • IDLE IDE • First Program • Other IDEs • Python Basics • Variables and Data Types • Operators • Type Conversion • Syntax and Structures • Input / Output • Identifiers • lines • Block and Indentation • Quotations • Comments
  • 3. Intro. ToPython 3of 75 Contents at a Glance • Control Flow • Composite Types • Lists • Tuples • Ranges • Dictionaries • Functions • Definitions and Calling • Nested Functions • First-Class Objects • Object-Oriented Python • Classes • Inheritance • Garbage Collection • Be Pythonic! • Summary • References JanBask Training
  • 4. What isPython? • Python is a widely-used general purpose (both industry and academia) high-level Programming language. • It combines the power of systems languages, such as C and Java, with the ease and rapid development of scripting languages, such as Ruby. Intro. ToPython 4of 75JanBask Training
  • 5. History andTimeline • Python Invented by Guido van Rossum in1991 at CWI in the Netherlands. • Python reached version 1.0 in January 1994. The major new features included in this release were the functional programming tools. Van Rossum Born: 31 January 1956 (age 58) Intro. ToPython 5of 75JanBask Training
  • 6. Intro. ToPython 6of 75 History andTimeline • Python 1.0 - January 1994 • Python 1.5 - December 31, 1997 • Python 1.6 - September 5, 2000 • Python 2.0 - October 16, 2000 • Python 2.1 - April 17, 2001 • Python 2.2 - December 21, 2001 • Python 2.3 - July 29, 2003 • Python 2.4 - November 30, 2004 • Python 2.5 - September 19, 2006 • Python 2.6 - October 1, 2008 • Python 2.7 - July 3, 2010 • Python 3.0 - December 3, 2008 • Python 3.1 - June 27, 2009 • Python 3.2 - February 20, 2011 • Python 3.3 - September 29, 2012 • Python 3.4 - March 16, 2014 JanBask Training
  • 7. Intro. ToPython 7of 75 Python 2 and 3 • Python 2.0 was released in 2000, with many new features added. • Python 3.0, adjusting several aspects of the core language, was released in 2008. • Python 3.0 is backwards-incompatible. • Codes written for Python 2.x may not work under 3.x! • Python 2.x is legacy, Python 3.x is the present and future of the language. JanBask Training
  • 8. Intro. ToPython 8of 75 Language Philosophy • Beautiful is better than ugly • Explicit is better than implicit • Simple is better than complex • Complex is better than complicated • Flat is better than nested • Sparse is better than dense JanBask Training
  • 9. Intro. ToPython 9of 75 Key Features • Simple and Minimalistic • Easy to Learn • High-level Language • Portable • Interpreted • Embeddable • Extensive Libraries • Free, Open Source, … and Fun! JanBask Training
  • 10. Intro. ToPython 10of 75 Programming Paradigms • Python is a multi paradigm programming language. • Imperative • Functional • Object-Oriented • Aspect-Oriented • Logic (rule base) Programming (by extension) • … JanBask Training
  • 12. • Top 10 Programming Languages. • IEEE Spectrum’s 2014 Ranking. Popularity Infographic: Brandon Palacio http://spectrum.ieee.org Intro. ToPython 12of 75[JanBaskTraining]
  • 13. Intro. ToPython 13of 75[JanBaskTraining] Getting Started • There are three different ways to start Python 1. Interactive Interpreter • from Unix, Linux, DOS, etc. • Python shell begin with >>> 2. Script from the Command-line • Install python. • python [YourScriptFileName.py] 3. Integrated Development Environment (IDE) • You can run Python from a graphical user interface (GUI) environment. • All in One solution like IDLE in next slide.
  • 14. Getting Started • IDLE IDE • Download Python from http://python.org • Install it. • Run it. Intro. ToPython 14of 75[JanBaskTraining]
  • 15. Python Shell Intro. ToPython 15of 75[JanBaskTraining]
  • 16. Simple Script with Output Intro. ToPython 16of 75[JanBaskTraining]
  • 17. Other IDEs:PyDev • PyDev is a Python IDE for Eclipse • http://pydev.org/ Intro. ToPython 17of 75[JanBaskTraining]
  • 18. Other IDEs: Visual Studio Intro. ToPython 18of 75[JanBaskTraining]
  • 19. Intro. ToPython 19of 75[JanBaskTraining] Python Basics: Objects and Variables • In python everything is an object. • So a variable is an object. • A variable is name given to a memory location to store value in the computer’s main storage.
  • 20. Intro. ToPython 20of 75[JanBaskTraining] Python Basics: Objects and Variables • Every object / Variable has three components: 1. Identity • Object’s address in memory does not change once it has been created. 2. Type (or Class) • A set of values and the allowable operations on those values exist foreach type. • Type of type is type!!! 3. Value • To bind value to a variable using assignment operator ( = ), for example: • x = 12345
  • 21. Python Basics: Objects and Variables • Python is a dynamically typed language, so: • Use Late Binding (run time binding). • No need to declare variable before binding a value. • Any given variable can have its value altered at any time! Intro. ToPython 21of 75[JanBaskTraining]
  • 22. Primitive DataTypes • Python has some standard types that are used to define the operations possible on them and the storage method for each of them. Intro. ToPython 22of 75[JanBaskTraining]
  • 23. Primitive DataTypes Intro. ToPython 23of 75[JanBaskTraining]
  • 24. Intro. ToPython 24of 75[JanBaskTraining] Operators • Basic Operators • Arithmetic (+, - , *, /, %, //, **) • Assignment (=, +=, -=, *=, /=, %=, //= ,**= ) • Comparison (<, >, <=, >=, ==, !=) • Logical (and, or, not) • Notes: • + on strings does string concatenation • * on (string * int) repeats string
  • 25. Operators Intro. ToPython 25of 75[JanBaskTraining]
  • 26. Type Conversion • Python has strong typing language (unlike JavaScript) • We need to use type converter functions: Intro. ToPython 26of 75[JanBaskTraining]
  • 27. Syntax and Semantic: Simplicity • Python syntax is simple, simple, simple!!! • Full python grammar (BNF) is less than 120 line! • There are less than 35 keywords in python. Intro. ToPython 27of 75[JanBaskTraining]
  • 28. Syntax and Semantic: Powerfully SimpleSwapinJava: SimpleSwapinPython: Intro. ToPython 28of 75[JanBaskTraining]
  • 29. Input andOutput Script tocalculate circle area: Output: Intro. ToPython 29of 75[JanBaskTraining]
  • 30. Intro. ToPython 30of 75[JanBaskTraining] Identifiers • A Python identifier is a name used to identify a variable, function, class, module, or other object. • An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores, and digits (0 to 9). • Python does not allow punctuation characters such as @, $, and % within identifiers. • Python is a case sensitive programming language. Thus Var and var are two different identifiers in Python.
  • 31. Lines • Single-Line Statements • Statements in Python typically end with a new line. • Multi-Line Statements • character ‘’ use to denote that the line should continue. Intro. ToPython 31of 75[JanBaskTraining]
  • 32. Lines • Statements contained within the [ ], { }, or ( ) brackets do not need to use the line continuation character. For example: • line containing only whitespace, possibly with a comment, is known as a blank line, and Python totally ignores it. Intro. ToPython 32of 75[JanBaskTraining]
  • 33. Lines • Multiple Statements on a Single Line • The semicolon ( ; ) allows multiple statements on the single line. • Multiple Statement Groups called Suites • Groups of individual statements making up a single code block are called suites. • Compound or complex statements, such as “if”, “while”, “def”, and “class”, are those which require a header line and a suite. Intro. ToPython 33of 75[JanBaskTraining]
  • 34. Intro. ToPython 34of 75[JanBaskTraining] Blocks andIndentations • Blocks begin with colon mark ( : ) • Nested blocks are allowed. • Line Indentation use to determine blocks scope! • The number of spaces in the indentation is variable, but all statements within the block must be indented the same amount • pass keyword use to fill empty or not implementation blocks body. • pass ≡ do nothing
  • 35. Quotations • Python accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long as the same type of quote starts and ends the string. • The triple quotes can be used to span the string across multiple lines. Intro. ToPython 35of 75[JanBaskTraining]
  • 36. Comments • A hash sign (#) that is not inside a string literal begins a comment. • All characters after the # and up to the physical line end are part of the comment, and the Python interpreter ignores them. Intro. ToPython 36of 75[JanBaskTraining]
  • 37. Control Flow:Conditions • Like other languages, Python has if and else statements • Python’s “else-if” is spelled elif Intro. ToPython 37of 75[JanBaskTraining]
  • 38. Control Flow:Conditions • Python has an easy to use if-syntax for setting the value of a variable! Intro. ToPython 38of 75[JanBaskTraining]
  • 39. Intro. ToPython 39of 75[JanBaskTraining] Truth and Falsity Value Testing • Any object can be tested for truth value, for use in a condition. • False: 1. None (≡ 𝑛𝑢𝑙𝑙) 2. False (Python >= 2.2.1) 3. Zero of any numeric type, e.g., 0, 0.0, 0j 4. Any empty sequence or dictionary, e.g., ‘ ‘, ( ), [ ], { } • True: • Everything else
  • 40. Control Flow:Loops • While loop • The while loop continues to execute the same body of code until the conditional statement is no longer True. • We can use break and continue inside the loops Intro. ToPython 40of 75[JanBaskTraining]
  • 41. Control Flow:Loops • For loop • The for loop in Python is much simpler that other C-like languages. • We can use range() function to produce a list of numbers. Intro. ToPython 41of 75[JanBaskTraining]
  • 42. Intro. ToPython 42of 75[JanBaskTraining] Sequence Types • There are three basic sequence types: • lists • Tuples • range objects • Additional sequence types include: • Strings (str) • Binary Data (bytes, bytearray, memoryview)
  • 43. Intro. ToPython 43of 75[JanBaskTraining] Sequence Types • Sequence types are very like together. • All of them consist of iterables objects. • There are some difference: • Lists are mutable, heterogeneous. • Tuple are immutable, heterogeneous. • Ranges are immutable, homogeneous. • String are immutable, homogeneous. • Immutable ≡ 𝐶𝑎𝑛′ 𝑡 𝑢𝑠𝑒 𝑎𝑠 𝑙 − 𝑣𝑎𝑙𝑢𝑒
  • 44. Intro. ToPython 44of 75[JanBaskTraining] Lists • Lists are similar to arrays in C. One difference between them is that all the items belonging to a list can be of different data type. • [] – an empty list. • [6] – an one-element list. • [5, 1+2j, ’hello’] - a 3-element list (heterogeneous). • [[1,2], [3,4], [5,6]] - a list of lists.
  • 45. Intro. ToPython 45of 75[JanBaskTraining] Lists • Lists may be constructed in several ways: • Using a pair of square brackets to denote the empty list: • L = [] • Using square brackets, separating items with commas: • L = [a] or L = [a, b, c] • Using a list comprehension: • L = [x for x in iterable] • Using the type constructor: • L = list() or L = list(iterable)
  • 46. list comprehension • A compact way to process all or part of the elements in a sequence and return a list with the results. • result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0] • generates a list of strings containing even hex numbers (0x..) in the range from 0 to 255. • The if clause is optional. If omitted, all elements in range(256) are processed. Intro. ToPython 46of 75[JanBaskTraining]
  • 47. Intro. ToPython 47of 75[JanBaskTraining] Tuples • A tuple is another sequence data type that is similar to the list. • A tuple consists of a number of values separated by commas. • The main differences between lists and tuples are: • Lists are enclosed in brackets ( [ ] ), and their elements and size can be changed, while tuples are enclosed in parentheses ( ( ) ) and cannot be updated. • Tuples can be thought of as read-only lists.
  • 48. Intro. ToPython 48of 75[JanBaskTraining] Tuples • Tuples may be constructed in a number of ways: • Using a pair of parentheses to denote the empty tuple: • T = () • Using a trailing comma for a singleton tuple: • T= 1, or T = (1,) • Separating items with commas: • a, b, c or (a, b, c) • Using the tuple() built-in: • T = tuple() or T = tuple(iterable)
  • 49. Intro. ToPython 49of 75[JanBaskTraining] Ranges • The range type represents an immutable sequence of numbers and is commonly used for looping a specific number of times in for loops. • The advantage of the range type over a regular list or tuple is that a range object will always take the same (small) amount of memory, no matter the size of the range it represents (as it only stores the start, stop and step values, calculating individual items and subranges as needed).
  • 50. Ranges Intro. ToPython 50of 75[JanBaskTraining]
  • 51. Common SequenceOperations Intro. ToPython 51of 75[JanBaskTraining]
  • 52. Intro. ToPython 52of 75[JanBaskTraining] Dictionaries • Python's dictionaries are hash table type. They work like associative arrays in Perl and consist of key-value pairs. • Keys can be almost any Python type, but are usually numbers or strings. Values, on the other hand, can be any arbitrary Python object. • Dictionaries are enclosed by curly braces ( { } ) and values can be assigned and accessed using square braces ( [] ). • Dictionaries have no concept of order among elements. It is incorrect to say that the elements are “out of order”; they are simply unordered.
  • 53. Dictionaries Intro. ToPython 53of 75[JanBaskTraining]
  • 54. Intro. ToPython 54of 75[JanBaskTraining] Functions • Function objects are created by function definitions. The only operation on a function object is to call it: • function-name(argument-list). • There are really two flavors of function objects: • built-in functions • user-defined functions. • Both support the same operation (to call the function), but the implementation is different, hence the different object types.
  • 55. Intro. ToPython 55of 75[JanBaskTraining] Methods • Method is a function defined in a class namespace. • There are two flavors: • built-in methods (such as append() on lists) • class instance methods. • Built-in methods are described with the types that support them.
  • 56. Intro. ToPython 56of 75[JanBaskTraining] Define Functions • Function blocks begin with the keyword def followed by the function name and parentheses. • The first statement of a function can be an optional statement - the documentation string of the function or docstring. • The code block within every function starts with a colon ( : ) and is indented. • The statement return [expression] exits a function, optionally passing back an expression to the caller. A return statement with no arguments is the same as return None.
  • 57. Define Functions Intro. ToPython 57of 75[JanBaskTraining]
  • 58. Intro. ToPython 58of 75[JanBaskTraining] Arguments Passing • Pass by reference vs value • All parameters (arguments) in the Python language are passed by reference. • If you change what a parameter refers to within a function, the change also reflects back in the calling function. • If you assigned new value to parameter by assign operation (=), new reference will be created (call by value!!!) • So python provide two semantic by one syntax in function calling!!!
  • 59. Arguments Passing Intro. ToPython 59of 75[JanBaskTraining]
  • 60. Arguments Passing Intro. ToPython 60of 75[JanBaskTraining]
  • 61. Intro. ToPython 61of 75[JanBaskTraining] Arguments Types • You can call a function by using the following types of formal arguments: • Required arguments • Keyword arguments • Default arguments • Variable-length arguments
  • 62. Arguments Types Intro. ToPython 62of 75[JanBaskTraining]
  • 63. Intro. ToPython 63of 75[JanBaskTraining] Nested Functions • Function scopes (and class scopes) can be nested. • Python using static scope. • Inner function can’t access to variables reference exist in outer function but R-Value allowed! • nonlocal keyword use to access outer variables so dynamic scope will provide!!!
  • 64. Nested Functions Intro. ToPython 64of 75[JanBaskTraining]
  • 65. First-Class Objects • Almost everything (including functions, classes, etc) in Python is a first-class object! Intro. ToPython 65of 75[JanBaskTraining]
  • 66. First-Class Objects Intro. ToPython 66of 75[JanBaskTraining]
  • 67. Object-Oriented Python • Python support object-oriented (class and objects) • Python support multiple inheritance Intro. ToPython 67of 75[JanBaskTraining]
  • 68. Object-Oriented Python Intro. ToPython 68of 75[JanBaskTraining]
  • 69. Intro. ToPython 69of 75[JanBaskTraining] Destroying Objects (Garbage Collection) • Allocating and freeing memory is not your problem! • Python uses reference counting. • An object's reference count increases when it's assigned a new name or placed in a container (list, tuple, etc). The object's reference count decreases when it's deleted with del. • When an object's reference count reaches zero, Python collects it automatically.
  • 70. Be Pythonic! Intro. ToPython 70of 75[JanBaskTraining]
  • 71. Intro. ToPython 71of 75[JanBaskTraining] Alternative PythonImplementations • CPython: Traditional implementation of Python that we used in this introduction. • IronPython: Python running on .NET • Jython: Python running on the Java Virtual Machine (JVM) • PyPy: A fast python implementation with a just in-time (JIT) compiler. • More: • https://www.python.org/download/alternatives
  • 72. Intro. ToPython 72of 75[JanBaskTraining] Famous Apps. written in python • Dropbox: A web-based file hosting service • BitTorrent: original client, along with several derivatives. • Ubuntu Software Center: A graphical package manager, installed by default in Ubuntu 9.10 and higher. • More: • http://en.wikipedia.org/wiki/List_of_Python_software
  • 73. Summary • Python is • High-Level • Multi-Paradigm • and has • Dynamic Type • Strong Type • and use • Call by Reference(and value) • Static (and Dynamic) Scope Intro. ToPython 73of 75[JanBaskTraining]
  • 74. Reference 1. Python Official Website • http://python.org/ 2. Python 3 Documentation • http://docs.python.org/3/ 3. Python Tutorials • http://www.tutorialspoint.com/python/ 74of 75