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

What's hot (20)

PPTX
Introduction to python
Ayshwarya Baburam
 
PPTX
Introduction to the basics of Python programming (part 1)
Pedro Rodrigues
 
PDF
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Edureka!
 
PDF
Introduction To Python | Edureka
Edureka!
 
PPTX
Python
Aashish Jain
 
PPT
Python ppt
Mohita Pandey
 
PDF
pandas - Python Data Analysis
Andrew Henshaw
 
PPT
Introduction to Python
Nowell Strite
 
PPTX
Python programming
Ashwin Kumar Ramasamy
 
PDF
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Edureka!
 
PPTX
Python Scipy Numpy
Girish Khanzode
 
PDF
Python Matplotlib Tutorial | Matplotlib Tutorial | Python Tutorial | Python T...
Edureka!
 
ODP
Python Modules
Nitin Reddy Katkam
 
PPSX
Programming with Python
Rasan Samarasinghe
 
PDF
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Edureka!
 
PPTX
Python PPT
Edureka!
 
PDF
Introduction to python programming
Srinivas Narasegouda
 
PDF
Learn Python Programming | Python Programming - Step by Step | Python for Beg...
Edureka!
 
PDF
What is Multithreading In Python | Python Multithreading Tutorial | Edureka
Edureka!
 
Introduction to python
Ayshwarya Baburam
 
Introduction to the basics of Python programming (part 1)
Pedro Rodrigues
 
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Edureka!
 
Introduction To Python | Edureka
Edureka!
 
Python
Aashish Jain
 
Python ppt
Mohita Pandey
 
pandas - Python Data Analysis
Andrew Henshaw
 
Introduction to Python
Nowell Strite
 
Python programming
Ashwin Kumar Ramasamy
 
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Edureka!
 
Python Scipy Numpy
Girish Khanzode
 
Python Matplotlib Tutorial | Matplotlib Tutorial | Python Tutorial | Python T...
Edureka!
 
Python Modules
Nitin Reddy Katkam
 
Programming with Python
Rasan Samarasinghe
 
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Edureka!
 
Python PPT
Edureka!
 
Introduction to python programming
Srinivas Narasegouda
 
Learn Python Programming | Python Programming - Step by Step | Python for Beg...
Edureka!
 
What is Multithreading In Python | Python Multithreading Tutorial | Edureka
Edureka!
 

Viewers also liked (15)

PPTX
Viva Presentation - Fuzzy Logic and Dempster-Shafer Theory to Detect The Risk...
Andino Maseleno
 
PDF
Data Analysis and Visualization using Python
Chariza Pladin
 
PDF
How tech can spark social change
Anne-Marie Elias
 
PDF
Ebriks-An idea to change your bussiness growth
ebriksinfotech
 
PPSX
2018 Sony World Photography Awards: Featured Entries (1)
maditabalnco
 
PPT
Open Source Software in Libraries
Sukhdev Singh
 
PDF
Intro to Web Development Using Python and Django
Chariza Pladin
 
PDF
Approved budget Fiscal Year 2018
Houston Community College
 
PDF
LED Display Boards - (Moving LED Display)
Organized Outdoor Options
 
PDF
Roadmap for landing a role at a Tech Startup
Panji Gautama
 
PPTX
Peer to-peer mobile payments
Ishraq Al Fataftah
 
PDF
Game Development With Python and Pygame
Chariza Pladin
 
PDF
Top Libraries for Machine Learning with Python
Chariza Pladin
 
PDF
Free & Open Source Software (2017 update)
Frederik Questier
 
PPTX
Display Advertising's New Wave
Jonathan Mendez
 
Viva Presentation - Fuzzy Logic and Dempster-Shafer Theory to Detect The Risk...
Andino Maseleno
 
Data Analysis and Visualization using Python
Chariza Pladin
 
How tech can spark social change
Anne-Marie Elias
 
Ebriks-An idea to change your bussiness growth
ebriksinfotech
 
2018 Sony World Photography Awards: Featured Entries (1)
maditabalnco
 
Open Source Software in Libraries
Sukhdev Singh
 
Intro to Web Development Using Python and Django
Chariza Pladin
 
Approved budget Fiscal Year 2018
Houston Community College
 
LED Display Boards - (Moving LED Display)
Organized Outdoor Options
 
Roadmap for landing a role at a Tech Startup
Panji Gautama
 
Peer to-peer mobile payments
Ishraq Al Fataftah
 
Game Development With Python and Pygame
Chariza Pladin
 
Top Libraries for Machine Learning with Python
Chariza Pladin
 
Free & Open Source Software (2017 update)
Frederik Questier
 
Display Advertising's New Wave
Jonathan Mendez
 
Ad

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

PPTX
Python Demo.pptx
ParveenShaik21
 
PDF
Intro-to-Python-Part-1-first-part-edition.pdf
ssuser543728
 
PPTX
Python Demo.pptx
ParveenShaik21
 
PPTX
INTRODUCTION TO PYTHON.pptx
Nimrahafzal1
 
PDF
PythonStudyMaterialSTudyMaterial.pdf
data2businessinsight
 
PPTX
Python 3.pptx
HarishParthasarathy4
 
PPTX
Introduction to Python for Data Science and Machine Learning
ParrotAI
 
PPTX
Python
Sangita Panchal
 
PPTX
Introduction to Basics of Python
Elewayte
 
PPTX
Basic concept of Python.pptx includes design tool, identifier, variables.
supriyasarkar38
 
PPTX
python presentation.pptx
NightTune44
 
PDF
Python: An introduction A summer workshop
ForrayFerenc
 
PPTX
Introduction to Python programming Language
MansiSuthar3
 
PPTX
Introduction to Programming.pptx ok ok ok
846Sarthakpandey
 
PDF
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Michpice
 
PDF
web programming UNIT VIII python by Bhavsingh Maloth
Bhavsingh Maloth
 
PPTX
Programming Basics.pptx
mahendranaik18
 
PPTX
Review old Pygame made using python programming.pptx
ithepacer
 
PPTX
python_computer engineering_semester_computer_language.pptx
MadhusmitaSahu40
 
PDF
Introduction To Programming with Python
Sushant Mane
 
Python Demo.pptx
ParveenShaik21
 
Intro-to-Python-Part-1-first-part-edition.pdf
ssuser543728
 
Python Demo.pptx
ParveenShaik21
 
INTRODUCTION TO PYTHON.pptx
Nimrahafzal1
 
PythonStudyMaterialSTudyMaterial.pdf
data2businessinsight
 
Python 3.pptx
HarishParthasarathy4
 
Introduction to Python for Data Science and Machine Learning
ParrotAI
 
Introduction to Basics of Python
Elewayte
 
Basic concept of Python.pptx includes design tool, identifier, variables.
supriyasarkar38
 
python presentation.pptx
NightTune44
 
Python: An introduction A summer workshop
ForrayFerenc
 
Introduction to Python programming Language
MansiSuthar3
 
Introduction to Programming.pptx ok ok ok
846Sarthakpandey
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Michpice
 
web programming UNIT VIII python by Bhavsingh Maloth
Bhavsingh Maloth
 
Programming Basics.pptx
mahendranaik18
 
Review old Pygame made using python programming.pptx
ithepacer
 
python_computer engineering_semester_computer_language.pptx
MadhusmitaSahu40
 
Introduction To Programming with Python
Sushant Mane
 
Ad

More from Chariza Pladin (6)

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

Recently uploaded (20)

PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
PDF
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PDF
epi editorial commitee meeting presentation
MIPLM
 
PPTX
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
PDF
AI-Powered-Visual-Storytelling-for-Nonprofits.pdf
TechSoup
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PPTX
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
PDF
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
Horarios de distribución de agua en julio
pegazohn1978
 
epi editorial commitee meeting presentation
MIPLM
 
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
AI-Powered-Visual-Storytelling-for-Nonprofits.pdf
TechSoup
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 

Zero to Hero - Introduction to Python3