SlideShare a Scribd company logo
Python3: Zero to Hero
Introduction to Python3 Programming Language
July 2017
Chariza Pladin
Data Analyst - Accenture Inc.
chariza.b.pladin@accenture.com
AGENDA
● Intro to Python
● Why learn Python
● Basic Python Syntax
● Coding Time!
● Python Q/A
COURSE MODULE CODE COMPILER
Python3: Zero to Hero - Introduction to Python Programming
Zero to Hero - Introduction to Python3
High-level programming language for
general-purpose programming, created by Guido
van Rossum and first released in 1991.
Python
Python is great for backend web development,
data analysis, artificial intelligence, and scientific
computing. Many developers have also used
Python to build productivity tools, games, and
desktop apps, so there are plenty of resources to
help you learn.
Guido van Rossum
● University of Amsterdam
- MA in Mathematics and
Computer Science 1982
● Benevolent Dictator For
Life (BDFL)
● Google (2005 - Dec
2012)
● Dropbox (2012 - Present)
“ I was looking for a hobby programming
project that would keep me occupied during the
week around Christmas. My office ... would be
closed, but I had a home computer, and not
much else on my hands. “
Why learn Python?
Python3: Zero to Hero - Introduction to Python Programming
Great for
Beginners
Simple
Elegant
Syntax
Python takes coding like natural
human-language.
Not
overly
Strict
You don't need to define the
type of a variable in Python.
Expressive of Language
Python allows you to write programs having greater
functionality with fewer lines of code.
Very Flexible
As a dynamically typed language, Python is really
flexible. This means there are no hard rules on how to
build features, and you'll have more flexibility solving
problems using different methods.
Furthermore, Python is also more forgiving of errors, so
you'll still be able to compile and run your program
until you hit the problematic part.
Python on
Pseudocodes
Python3: Zero to Hero - Introduction to Python Programming
Career
Opportunities
and
the Future
Salary Range
Companies that uses Python
Django-Powered Applications
The import
system
Modules importing
Modules
Modules can define functions, classes, and variables that
you can reference in other Python .py files or via the Python
command line interpreter.
Modules are accessed by using the import statement.
When you do this, you execute the code of the module,
keeping the scopes of the definitions so that your current
file(s) can make use of these.
Python Frameworks
DATA
SCIENCE
MACHINE
LEARNING
GAME
DEVELOPMENT
WEB
DEVELOPMENT
Basic Syntax
Variable
A variable is a location in memory used to store some data
(value).
We don't need to declare a variable before using it.
In Python, we simply assign a value to a variable and it will
exist. We don't even have to declare the type of the variable.
This is handled internally according to the type of value we
assign to the variable.
Variable Assignment
We use the assignment operator (=) to assign values to a
variable. Any type of value can be assigned to any valid
variable.
Multiple Assignment
In Python, multiple assignments can be made in a single
statement as follows:
If we want to assign the same value to multiple variables at
once, we can do this as
Basic Operators
Basic Operators
Python language supports the following types of operators.
● Arithmetic Operators
● Comparison (Relational) Operators
● Assignment Operators
● Logical Operators
● Bitwise Operators
● Membership Operators
● Identity Operators
Basic Operators
● + Addition
● - Subtraction
● * Multiplication
● / Division
● % Modulus
● ** Exponent
● // Floor Division
Python Comparison Operators
● == Equal
● != Not Equal
● > Greater than
● < Less than
● >= Greater than or equal to
● <= Less than or equal to
Python Assignment Operators
● = Equal
● += Add AND
● -= Subtract AND
● *= Multiply AND
● /= Divide AND
● %= Modulus AND
● **= Exponent AND
● //= Floor Division
Python Bitwise Operators
● & Binary AND
● | Binary OR
● ^ Binary XOR
● ~ Binary Ones Complement
● << Binary Left Shift
● >> Binary Right Shift
Python Membership Operators
Python Identity Operators
Python Data Types
Data Types
Numeric Types
● int: Integers;
● long: Long integers of non-limited length;
● float: Floating-Point numbers, equivalent to C doubles
● complex: Complex Numbers
Sequences Types
● str: String;
● bytes: a sequence of integers in the range of 0-255; only available in Python 3.x
● byte array: like bytes, but mutable
● list
● tuple
Data Types (cont.)
Sets:
● set: an unordered collection of unique objects;
● frozen set: like set, but immutable
Mappings:
● dict: Python dictionaries, also called hashmaps or associative
arrays,
Mutable vs. Immutable Objects
Data types in Python can be distinguished based on whether objects of the type are
mutable or immutable. The content of objects of immutable types cannot be
changed after they are created.
Some immutable types: Some mutable types:
int, float, long, complex
str
bytes
tuple
frozen set
byte array
list
set
dict
List
List is the most versatile data type available in Python
which can be written as a list of comma-separated values
(items) between square brackets.
Important thing about a list is that items in a list need not
be of the same type.
List
Basic List Operations
Indexing, Slicing, and Matrixes
Built-in List
Functions
List
Methods
List
Methods
(cont.)
Tuple
Tuples are immutable which means you cannot update or
change the values of tuple elements.
Tuple Examples
Basic Tuple Operations
Indexing, Slicing, and Matrixes
Built-in
Tuple
Functions
Dictionary
Each key is separated from its value by a colon (:), the
items are separated by commas, and the whole thing is
enclosed in curly braces.
Keys are unique within a dictionary while values may not be.
The values of a dictionary can be of any type, but the keys
must be of an immutable data type such as strings,
numbers, or tuples.
Dictionary Examples
Accessing Values in Dictionary
Updating Values in Dictionary
Deleting Values in Dictionary
Dictionary
Function
and
Methods
Dictionary
Function
and
Methods
(cont.)
Built-in
Dictionary
Functions
Strings
Strings are amongst the most popular types in Python. We
can create them simply by enclosing characters in quotes.
Python treats single quotes the same as double quotes.
Creating strings is as simple as assigning a value to a
variable.
Accessing String Values
Python does not support a character type; these are treated
as strings of length one, thus also considered a substring.
Updating Strings
You can "update" an existing string by (re)assigning a
variable to another string. The new value can be related to
its previous value or to a completely different string
altogether.
Built-in
String
Methods
Built-in
String
Methods
(cont.)
Built-in
String
Methods
(cont.)
Built-in
String
Methods
(cont.)
Built-in
String
Methods
(cont.)
Python3: Zero to Hero - Introduction to Python Programming
Python Decision
Making
Decision Making
Decision making is anticipation of conditions occurring
while execution of the program and specifying actions
taken according to the conditions.
Decision structures evaluate multiple expressions which
produce TRUE or FALSE as outcome. You need to
determine which action to take and which statements to
execute if outcome is TRUE or FALSE otherwise.
Decision Making
Decision Making
Python3: Zero to Hero - Introduction to Python Programming
Python Loops
Loops
In general, statements are executed sequentially: The first
statement in a function is executed first, followed by the
second, and so on. There may be a situation when you need
to execute a block of code several number of times.
A loop statement allows us to execute a statement or group
of statements multiple times.
Loops
Loops Control
Range()
-returns an immutable sequence object of integers between
the given start integer to the stop integer.
Syntax:
range(stop)
range(start, stop[, step])
start - integer starting from which the sequence of
integers is to be returned
stop - integer before which the sequence of integers is
to be returned.
The range of integers end at stop - 1.
step (Optional) - integer value which determines the
increment between each integer in the sequence
Range() Parameters
Scope
Resolution
and the
LEGB Rule
Scope
“hierarchy level” in which we search namespaces for certain
“name-to-object” mappings.
Python3: Zero to Hero - Introduction to Python Programming
LEGB Rule
● Local can be inside a function or class method, for
example.
● Enclosed can be its enclosing function, e.g., if a
function is wrapped inside another function.
● Global refers to the uppermost level of the executing
script itself, and
● Built-in are special names that Python reserves for
itself.
Python Functions
Functions
A function is a block of organized, reusable code that is
used to perform a single, related action. Functions provide
better modularity for your application and a high degree of
code reusing.
Python3: Zero to Hero - Introduction to Python Programming
Function blocks begin with the keyword
def followed by the function name and
parentheses ( ( ) )
Any input
parameters or
arguments should
be placed within
these parentheses.
You can also define
parameters inside
these parentheses.the documentation
string of the
function or
docstring.
statement return [expression] exits a
function, optionally passing back an
expression to the caller.
Docstrings
A docstring is a string literal that occurs as the first
statement in a module, function, class, or method definition.
Such a docstring becomes the __doc__ special attribute of
that object.
Comments
Comments are little snippets of text embedded inside your
code that are ignored by the Python interpreter.
A comment is denoted by the hash character (#) and
extends to the end of the line.:
Functions Examples
Coding Time
Python3: Zero to Hero - Introduction to Python Programming
Test Cases
● Random Password Generator
● Pangram Word Test
● If-Else Allergic Arithmetic Operations
● Weird Case and Mexican Wave
Python3: Zero to Hero - Introduction to Python Programming
Python3: Zero to Hero - Introduction to Python Programming
Ask me
anything about
Python :)

More Related Content

PPTX
Full Python in 20 slides
PPTX
Intro to Python Programming Language
PPTX
Python 3 Programming Language
PDF
Python Basics | Python Tutorial | Edureka
PDF
Python course syllabus
PPTX
Python presentation by Monu Sharma
PPTX
Python
PDF
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Full Python in 20 slides
Intro to Python Programming Language
Python 3 Programming Language
Python Basics | Python Tutorial | Edureka
Python course syllabus
Python presentation by Monu Sharma
Python
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka

What's hot (20)

PDF
Python libraries
PPTX
Python OOPs
PDF
Overview of python 2019
PPT
Python Programming Language
PPT
Python ppt
PPTX
Beginning Python Programming
PPTX
Python Tutorial Part 1
PDF
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
PPTX
Python Functions
PPTX
Python - An Introduction
PPTX
Introduction to the basics of Python programming (part 1)
PPTX
Data Analysis in Python-NumPy
PPT
Python ppt
PDF
Variables & Data Types In Python | Edureka
PPTX
Python Datatypes by SujithKumar
PPTX
Object oriented programming in python
PDF
Datatypes in python
PPTX
Python Interview Questions | Python Interview Questions And Answers | Python ...
PPTX
Python Libraries and Modules
PPT
Introduction to Python
Python libraries
Python OOPs
Overview of python 2019
Python Programming Language
Python ppt
Beginning Python Programming
Python Tutorial Part 1
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions
Python - An Introduction
Introduction to the basics of Python programming (part 1)
Data Analysis in Python-NumPy
Python ppt
Variables & Data Types In Python | Edureka
Python Datatypes by SujithKumar
Object oriented programming in python
Datatypes in python
Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Libraries and Modules
Introduction to Python
Ad

Viewers also liked (15)

PPTX
Viva Presentation - Fuzzy Logic and Dempster-Shafer Theory to Detect The Risk...
PDF
Data Analysis and Visualization using Python
PDF
How tech can spark social change
PDF
Ebriks-An idea to change your bussiness growth
PPSX
2018 Sony World Photography Awards: Featured Entries (1)
PPT
Open Source Software in Libraries
PDF
Intro to Web Development Using Python and Django
PDF
Approved budget Fiscal Year 2018
PDF
LED Display Boards - (Moving LED Display)
PDF
Roadmap for landing a role at a Tech Startup
PPTX
Peer to-peer mobile payments
PDF
Game Development With Python and Pygame
PDF
Top Libraries for Machine Learning with Python
PDF
Free & Open Source Software (2017 update)
PPTX
Display Advertising's New Wave
Viva Presentation - Fuzzy Logic and Dempster-Shafer Theory to Detect The Risk...
Data Analysis and Visualization using Python
How tech can spark social change
Ebriks-An idea to change your bussiness growth
2018 Sony World Photography Awards: Featured Entries (1)
Open Source Software in Libraries
Intro to Web Development Using Python and Django
Approved budget Fiscal Year 2018
LED Display Boards - (Moving LED Display)
Roadmap for landing a role at a Tech Startup
Peer to-peer mobile payments
Game Development With Python and Pygame
Top Libraries for Machine Learning with Python
Free & Open Source Software (2017 update)
Display Advertising's New Wave
Ad

Similar to Zero to Hero - Introduction to Python3 (20)

PPTX
Python Demo.pptx
PDF
Intro-to-Python-Part-1-first-part-edition.pdf
PPTX
Python Demo.pptx
PPTX
INTRODUCTION TO PYTHON.pptx
PDF
PythonStudyMaterialSTudyMaterial.pdf
PPTX
Python 3.pptx
PPTX
Introduction to Python for Data Science and Machine Learning
PPTX
PPTX
Introduction to Basics of Python
PDF
Data Handling_XI_Finall for grade 11 cbse board
PPTX
Basic concept of Python.pptx includes design tool, identifier, variables.
PDF
Python Programminng…………………………………………………..
PPTX
python presentation.pptx
PDF
Python: An introduction A summer workshop
PDF
Data Handling_XI- All details for cbse board grade 11
PPTX
Introduction to Python programming Language
PPTX
Introduction to Programming.pptx ok ok ok
PDF
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
PDF
web programming UNIT VIII python by Bhavsingh Maloth
PPTX
Programming Basics.pptx
Python Demo.pptx
Intro-to-Python-Part-1-first-part-edition.pdf
Python Demo.pptx
INTRODUCTION TO PYTHON.pptx
PythonStudyMaterialSTudyMaterial.pdf
Python 3.pptx
Introduction to Python for Data Science and Machine Learning
Introduction to Basics of Python
Data Handling_XI_Finall for grade 11 cbse board
Basic concept of Python.pptx includes design tool, identifier, variables.
Python Programminng…………………………………………………..
python presentation.pptx
Python: An introduction A summer workshop
Data Handling_XI- All details for cbse board grade 11
Introduction to Python programming Language
Introduction to Programming.pptx ok ok ok
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
web programming UNIT VIII python by Bhavsingh Maloth
Programming Basics.pptx

More from Chariza Pladin (6)

PDF
Day 4 - Advance Python - Ground Gurus
PPTX
Ground Gurus - Python Code Camp - Day 3 - Classes
PDF
AI - The Good, Bad and scary truth of Super Intelligence
PDF
Computer vision and Open CV
PDF
Ground Gurus Introduction
PDF
Introduction to Machine learning with Python
Day 4 - Advance Python - Ground Gurus
Ground Gurus - Python Code Camp - Day 3 - Classes
AI - The Good, Bad and scary truth of Super Intelligence
Computer vision and Open CV
Ground Gurus Introduction
Introduction to Machine learning with Python

Recently uploaded (20)

PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Complications of Minimal Access Surgery at WLH
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Presentation on HIE in infants and its manifestations
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Cell Structure & Organelles in detailed.
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Anesthesia in Laparoscopic Surgery in India
2.FourierTransform-ShortQuestionswithAnswers.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Complications of Minimal Access Surgery at WLH
O7-L3 Supply Chain Operations - ICLT Program
Presentation on HIE in infants and its manifestations
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Chinmaya Tiranga quiz Grand Finale.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Cell Structure & Organelles in detailed.
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
GDM (1) (1).pptx small presentation for students
Computing-Curriculum for Schools in Ghana
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
school management -TNTEU- B.Ed., Semester II Unit 1.pptx

Zero to Hero - Introduction to Python3