SlideShare a Scribd company logo
1 of 47
Download to read offline
PYTHON
& YOU
NETWORK WEEK 2015 WORKSHOP
SIAN LERK LAU
linkedin.com/in/sianlerk
sianlerk.lau@onapp.com | kiawin@gmail.com
Software Engineer
Volunteer
Educator-in-Exile
https://twitter.com/OnApp - https://facebook.com/OnApp
WONDERFUL THINGS WE DO =)
Python, Java, Ruby, Lua, Nginx, Wowza, Puppet, Vagrant,
Docker, Debian, Cucumber, RabbitMQ, MariaDB, MongoDB,
ELK, etc.
WE’RE HIRING!
SYSADMIN as integral role in managing and
develop tools for our ecosystem
DEV as engineering role in creating bleeding edge
applications for our ecosystem
YES, INTERNS TOO!
R U
REHDY
TO PYTHON*
FIVE
DEADLY
SINS
OF COMPUTER SCIENCE
I DO EVERYTHING
EXCEPT
int main(void);
NO. 5
I DO CODING
EXCEPT
for (;;);
NO. 4
I DO EVERYTHING
EXCEPT
MATHS
NO. 3
I DO NOTHING
EXCEPT
<NAME YOUR LANGUAGE>
NO. 2
I DO NOTHING
EXCEPT
MY {WORK, STUDY}
NO. 1
EVER
CHANGING
INDUSTRY
OF COMPUTER SCIENCE
SOFTWARE
DEVELOPMENT
IS ABOUT
LEARNING
NO. 5
SOFTWARE
DEVELOPMENT
IS ABOUT
ENGINEERING
NO. 4
SOFTWARE
DEVELOPMENT
IS ABOUT
SPEED
NO. 3
SOFTWARE
DEVELOPMENT
IS ABOUT
BUSINESS
NO. 2
SOFTWARE
DEVELOPMENT
IS ABOUT
COMMUNITY
NO. 1
SOFTWARE
DEVELOPMENT
IS ABOUT
YOU
NO. 0
DO.
* WHY PYTHON
* THE ENVIRONMENT
* PYTHON 101
* CONTROL STRUCTURES
* A REAL PROGRAM
WHY*
CODE IN PYTHON
EASY TO UNDERSTAND
CONCISE SYNTAX
MULTI-PURPOSE
STRENGTH OF PYTHON
GOOGLE-ABLE!
WELL SUPPORTED LIBS
FAST TO DELIVER
STRENGTH OF PYTHON
ENV*
PYTHON ENVIRONMENT
# INSTALL PACKAGES
$ sudo apt-get install python-pip
python-virtualenv
# SETUP ENVIRONMENT
$ virtualenv workshop-env
# ENABLE ENVIRONMENT
$ source workshop-env/bin/activate
ENV* - ENVIRONMENT ISOLATION
101*
PYTHON - DATA TYPES
# DECLARE-LESS TYPED
>>> a = 1
>>> print a
1
>>> type(a)
<type 'int'>
101* - DATA TYPES
# MORE TYPES - '' and ""
>>> b = 'a'
>>> c = 'abc'
>>> d = "abc"
# QUIZ: WHAT DATA TYPES ARE b, c and d?
>>> type(b)
>>> type(c)
>>> type(d)
101* - DATA TYPES
# MORE TYPES
# bool, NoneType, float, long
>>> e = True
>>> f = False
>>> g = None
>>> h = 1.0
>>> i = 1L
# QUIZ: WHAT IS None?
101* - DATA TYPES
101*
PYTHON - COLLECTIONS
# COLLECTION 1: LIST
>>> a = [1, 2, 3]
>>> b = list()
>>> b.append(1)
>>> b.append(2)
>>> b.append(3)
# QUIZ: How do we retrieve the value?
# QUIZ: Is a and b same?
101* - DATA TYPES
# SAME - EQUALITY or IDENTITY?
>>> a == b
True
>>> a is b
False
# QUIZ: WHAT IS THE DIFF
# BETWEEN == AND is
101* - DATA TYPES
# COLLECTION 2 - TUPLE
>>> c = (1, 2, 3)
>>> d = 1, 2, 3
# QUIZ: SO AGAIN, IS c SAME with d?
101* - DATA TYPES
# COLLECTION 3: dict
>>> e = {1: 11, 2: 22}
>>> e[1]
>>> e[2]
# QUIZ: IS THIS AN array?
# QUIZ: MUST THE key BE int?
101* - DATA TYPES
# COLLECTION 4: set
>>> f = set()
>>> f.add(1)
>>> f.add(2)
>>> f.add(3)
# QUIZ: WHAT IS THE DIFF
# BETWEEN list AND set?
101* - DATA TYPES
101*
PYTHON - CONTROL STRUCTURES
101* - DATA TYPES
# if, else, elif
>>> a = 2
>>> if a == 1:
... print "hello"
... elif a == 2:
... print "world"
>>>
101* - DATA TYPES
# if, else, elif CONTINUES
>>> a = 1
>>> if a == 1:
... print "hello"
... else:
... print "world"
>>>
101* - DATA TYPES
# for LOOP
>>> for i in [1, 2, 3]:
... print i
>>> for j in range(1,3):
... print j
# QUIZ: WHAT DO YOU SEE WHEN print j
101* - DATA TYPES
# for LOOP
>>> for i in (1, 2, 3):
... print i
>>> for k,v in {1: 11, 2: 22}.iteritems():
... print k, v
# QUIZ: WHAT DO YOU SEE WHEN print k, v
101* - DATA TYPES
# list comprehension
>>> a = [1,2,3,4,5]
>>> b = [i+1 for i in a]
# QUIZ: WHAT IS THE VALUE OF b?
101* - DATA TYPES
# list comprehension
>>> a = [1,2,3,4,5]
>>> b = [i for i in a if i % 2 == 0]
# QUIZ: WHAT IS THE VALUE OF b?
PROG*
A REAL PROGRAM, NOW
# CREATE AN EXECUTABLE FILE
$ touch calculator.py
$ chmod +x calculator.py
# QUIZ: MUST YOU END THE FILENAME WITH
# A FILE EXTENSION?
PROG* - A REAL PROGRAM
# IMPROVISE IT
$ vim calculator.py
$ nano calculator.py
<or, use your favourite text editor>
# RUN IT
$ ./calculator.py
PROG* - A REAL PROGRAM
Q&A*
ASK ME ANYTHING

More Related Content

Viewers also liked

OSCON 2008: Porting to Python 3.0
OSCON 2008: Porting to Python 3.0OSCON 2008: Porting to Python 3.0
OSCON 2008: Porting to Python 3.0
guest4d09
 
Future Programming Language
Future Programming LanguageFuture Programming Language
Future Programming Language
YLTO
 
Python twitterとtkinterのことはじめ
Python twitterとtkinterのことはじめPython twitterとtkinterのことはじめ
Python twitterとtkinterのことはじめ
Yukitaka Uchikoshi
 

Viewers also liked (20)

Python and Flask introduction for my classmates Презентация и введение в flask
Python and Flask introduction for my classmates Презентация и введение в flaskPython and Flask introduction for my classmates Презентация и введение в flask
Python and Flask introduction for my classmates Презентация и введение в flask
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90mins
 
LvivPy - Flask in details
LvivPy - Flask in detailsLvivPy - Flask in details
LvivPy - Flask in details
 
Cc code cards
Cc code cardsCc code cards
Cc code cards
 
Apache Web Server Setup 3
Apache Web Server Setup 3Apache Web Server Setup 3
Apache Web Server Setup 3
 
Introduction to Graphics
Introduction to GraphicsIntroduction to Graphics
Introduction to Graphics
 
Python 3000
Python 3000Python 3000
Python 3000
 
Python programming lab2
Python programming lab2Python programming lab2
Python programming lab2
 
OSCON 2008: Porting to Python 3.0
OSCON 2008: Porting to Python 3.0OSCON 2008: Porting to Python 3.0
OSCON 2008: Porting to Python 3.0
 
Securing Apache Web Servers
Securing Apache Web ServersSecuring Apache Web Servers
Securing Apache Web Servers
 
PyTrening 2.0 # 15 Okienka GUI
PyTrening 2.0 # 15 Okienka GUIPyTrening 2.0 # 15 Okienka GUI
PyTrening 2.0 # 15 Okienka GUI
 
Python programming lab1
Python programming lab1Python programming lab1
Python programming lab1
 
Future Programming Language
Future Programming LanguageFuture Programming Language
Future Programming Language
 
Apache Web Server Setup 2
Apache Web Server Setup 2Apache Web Server Setup 2
Apache Web Server Setup 2
 
Python twitterとtkinterのことはじめ
Python twitterとtkinterのことはじめPython twitterとtkinterのことはじめ
Python twitterとtkinterのことはじめ
 
10 more-things-you-can-do-with-python
10 more-things-you-can-do-with-python10 more-things-you-can-do-with-python
10 more-things-you-can-do-with-python
 
An introduction-to-tkinter
An introduction-to-tkinterAn introduction-to-tkinter
An introduction-to-tkinter
 
Tkinter Does Not Suck
Tkinter Does Not SuckTkinter Does Not Suck
Tkinter Does Not Suck
 
Begin with Python
Begin with PythonBegin with Python
Begin with Python
 
Chapter 11 Presentation
Chapter 11 PresentationChapter 11 Presentation
Chapter 11 Presentation
 

Similar to Python and you

intro_to_python_20150825
intro_to_python_20150825intro_to_python_20150825
intro_to_python_20150825
Shung-Hsi Yu
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
DRVaibhavmeshram1
 
Intro to programming
Intro to programmingIntro to programming
Intro to programming
Arvin Buendia
 
Python for High School Programmers
Python for High School ProgrammersPython for High School Programmers
Python for High School Programmers
Siva Arunachalam
 
Python language data types
Python language data typesPython language data types
Python language data types
Harry Potter
 
Python language data types
Python language data typesPython language data types
Python language data types
Young Alista
 

Similar to Python and you (20)

Introduction to Python and TensorFlow
Introduction to Python and TensorFlowIntroduction to Python and TensorFlow
Introduction to Python and TensorFlow
 
Python slide
Python slidePython slide
Python slide
 
Introduction to Python3 Programming Language
Introduction to Python3 Programming LanguageIntroduction to Python3 Programming Language
Introduction to Python3 Programming Language
 
Teng tips
Teng tipsTeng tips
Teng tips
 
Creating a compiler in Perl 6
Creating a compiler in Perl 6Creating a compiler in Perl 6
Creating a compiler in Perl 6
 
python.pdf
python.pdfpython.pdf
python.pdf
 
intro_to_python_20150825
intro_to_python_20150825intro_to_python_20150825
intro_to_python_20150825
 
Pre-Bootcamp introduction to Elixir
Pre-Bootcamp introduction to ElixirPre-Bootcamp introduction to Elixir
Pre-Bootcamp introduction to Elixir
 
Ds program-print
Ds program-printDs program-print
Ds program-print
 
Elixir in a nutshell - Fundamental Concepts
Elixir in a nutshell - Fundamental ConceptsElixir in a nutshell - Fundamental Concepts
Elixir in a nutshell - Fundamental Concepts
 
Monads in Ruby - Victor Zagorodny
Monads in Ruby - Victor ZagorodnyMonads in Ruby - Victor Zagorodny
Monads in Ruby - Victor Zagorodny
 
Python Workshop
Python  Workshop Python  Workshop
Python Workshop
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
Python-The programming Language
Python-The programming LanguagePython-The programming Language
Python-The programming Language
 
A Skeptics guide to functional style javascript
A Skeptics guide to functional style javascriptA Skeptics guide to functional style javascript
A Skeptics guide to functional style javascript
 
Intro to programming
Intro to programmingIntro to programming
Intro to programming
 
Python for High School Programmers
Python for High School ProgrammersPython for High School Programmers
Python for High School Programmers
 
Python language data types
Python language data typesPython language data types
Python language data types
 
Python language data types
Python language data typesPython language data types
Python language data types
 
Python language data types
Python language data typesPython language data types
Python language data types
 

More from Sian Lerk Lau

More from Sian Lerk Lau (6)

Solving performance issues in Django ORM
Solving performance issues in Django ORMSolving performance issues in Django ORM
Solving performance issues in Django ORM
 
The journey of an (un)orthodox optimization
The journey of an (un)orthodox optimizationThe journey of an (un)orthodox optimization
The journey of an (un)orthodox optimization
 
Velocity. Agility. Python. (Pycon APAC 2017)
Velocity. Agility. Python. (Pycon APAC 2017)Velocity. Agility. Python. (Pycon APAC 2017)
Velocity. Agility. Python. (Pycon APAC 2017)
 
DevOps - Myth or Real
DevOps - Myth or RealDevOps - Myth or Real
DevOps - Myth or Real
 
Quality of life through Unit Testing
Quality of life through Unit TestingQuality of life through Unit Testing
Quality of life through Unit Testing
 
Install Archlinux in 10 Steps (Sort of) :)
Install Archlinux in 10 Steps (Sort of) :)Install Archlinux in 10 Steps (Sort of) :)
Install Archlinux in 10 Steps (Sort of) :)
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Python and you