SlideShare a Scribd company logo
Eran Shlomo, Intel perceptual computing
eran.shlomo@intel.com ©
About me
Haifa IoT Ignition lab and IPP(Intel ingenuity partnership program) tech lead.
Intel Perceptual computing.
Python expert, started around 2009 with silicon analytics.
Focus on Data science and Machine learning in recent years (A lot of python).
About the PyCourse
Self driving course 
Just follow the slides, it is built both for self work as well as class work.
If you are not in class make sure to read the attached references and links.
If you are in class then read them later.
Why do you want to learn python ?
• Very fast prototyping.
• Cross platform.
• Rich libraries and capabilities.
• Good interactive/console experience.
• Fast engine (in script land)
• The leading language in AI world.
• More on The good, The bad and the ugly of python can be found here:
https://www.slideshare.net/EranShlomo/python-the-good-the-bad-and-the-ugly
Before we start
• Download and Install python 2.7
• Download, do not install :
• Download, python 3.5, pycharm, miniconda and google python classes.
Hello world
• Lets check we have python installed and good to go:
• Go to the folder you have extracted the course package zip, lets call it our working dir
• Open cmd in your working dir and check python is functional and in the right (2.7.12) version:
• If no python update your path, if version is incorrect change path variable order, you can check its
properly configured using where :
Lets make a simple hello world file and run it, create a file called hello.py and put in it a single
line printing hello:
• print "hello pycourse“
• Save and run it in cmd console:
• python hello.py
•
No python, in cmd type : set
PATH=C:Python27;%PATH%
Python versions
Python versions have significant importance, Python world struggles to move between
versions and there are many compatibility issues. Lets run our script on python 3:
• Install python 3.5.2
• Open cmd on working dir
• Set python 3 path to take priority :set PATH=<python 3 path>;%PATH%
• Run python - - version and make sure python version is right.
• Run our hello: fails …. Fix it:
• In python 3 print is no longer statement but function , many more differences…
• See more : http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html
Packaging
Python packing is pretty messy with a lot of ambiguity, today in python community the two leading
ones are:
• Easy_install – 2004, python first significant attempt to supply packaging mechanism
• Pip – 2008, alternative to easy_install and the common one as of today.
For more details : https://packaging.python.org/pip_easy_install/
There are two main aspect to packaging:
• I want to use packages in my project
• I want to package my project for others – out of this course scope.
Lets install a package, virtualenv:
• In command line, working dir (we are still in python 3) type: pip install virtualenv
Our python root
Being familiar with your python root structure is very important, many times
debug will take you there.
Lets look for our virtualenv package install:
• Go to python home, reminder where python will show you home.
• Under Lib you will find the packages and models (later on difference) that
comes with install. You will also find a folder called site-packages - our freshly
installed virtualenv package is there.
• Any packages we install will go there as well, which becomes pretty messy
after a while as different project requires different packages and versions.
Virtual environments
In order to allow developers easily develop between versions (many times you need to
work on many different version on the same machine) we have virtualenv package.
More details : http://docs.python-guide.org/en/latest/dev/virtualenvs/
This package allows you to create an isolated python environments, each with its own
dependencies and navigate between them. Lets create virtural environment:
• In our work dir type in console :virtualenv pycourse
• This creates virtual environment with the name pycourse, and installs base python +
setuptools into it, notice virtual env folder was created under sub dir pycourse
• Activate the virtualenv , in cmd type : .pycourseScriptsactivate
• And now deactivate it , in cmd type : .pycourseScriptsdeactivate
Module and packages
• Python has two main mechanisms for managing code blocks: modules and packages. Both
are almost the same conceptually, packages allows you to create more complex file structures
and name spaces:
• Module – single .py file
• Package – directory with __init__.py in it, can conatain sub packages.
Lets create an hello module and run it :
 create a file called hello_mod.py with the code, print ("hello pycourse module”)
 Create a subfolder called hello_pack, inside it create a file called __init__.py with the code,
print ("hello pycourse package ”)
 create a file called main.py with the following :
 Run main.py :
 Read more on the matter http://knowpapa.com/modpaclib-py/
Function
Lets make a function in hello mod:
• Python uses indentation as block, use 4 spaces for every block. Indentation rules can be found
here but keeping in mind 4 spaces in what usually is {}:
• Using Ide usually takes care of that for you easily.
• http://www.peachpit.com/articles/article.aspx?p=1312792&seqNum=3
Add function to hello_mod.py so it look like:
Lets run it, this time in console: run python in cmd, this will get you into interactive interpreter
mode. Now you can code directly into the interpreter. Import the module and call the function:
.
.
.
Time to IDE
Once we go into more coding IDE becomes extremely usefull, There are many IDEs out there, we will be using
JetBrains Pycharm, install it (download or take from course distribution).
Lets create a project with our code:
• File Create new project
• Put location of your work dir, choose interpreter of your python 3.5.2 install.
•
• Pycharm will warn on existing code, confirm it – it will create project with your code.
• Run main on ide, now run menu is empty :
• Right click main.py and click run main:
• And now run menu is active, with main as default run config:
• Put a breakpoint in the hello function and click debug :
• Debug button :
Classes
So we have an IDE working, pycharm is a great distribution of eclipse & pydev, so if you are
coming from JAVA you might feel at home pretty fast.
Python have two type of classes : classic and new style, always use the new style, notice the
pass keyword:
More on pass: https://www.tutorialspoint.com/python/python_pass_statement.htm
More on class stype differences:
http://stackoverflow.com/questions/54867/what-is-the-difference-between-old-style-and-new-style-
classes-in-python
Create an hello class inside hello_mod, new style as follows:
notice the self reference, it’s the python equivalent of this
Run main in pycharm and see in output console the result
CLASSIC
NEW
Wrapping point – short exercise
Build an image class rotator, Using the pillow package. Do the following:
• Install the Pillow package
• Build a class rotator with the following methods:
• Load – load an image to the rotator, parameter :im_path
• Rotate – rotate the image , parameter :rotation
• save– saves the currently rotated image, parameter :im_path
• Run the following code using your class and lena.jpg (inside project package, or choose
image of your choice) to get rotated images:
• Take the time to understand the code, first time we see loop and string formatting
PEPs
Python is developed and progress using PEPs, Python Enhancements Proposal
This is how community decides on language future and features, PEP0 contains the full
list: https://www.python.org/dev/peps/
As you are becoming python programmer, let go over PEP8:
• Authored by Guido, contains the “right syntax style” to python.
• Stick to PEP8
• PyCharm actually mark you where you got it wrong:
• Two violations here, import not on top, missing two blank lines.
• Nice feature : PyCharm contains auto fix under CodeReformat code
Read PEP20, we will get back to it later  - https://www.python.org/dev/peps/pep-0020/
Time to revisit our project folder
So while we are inside our nice and cozy IDE stuff is happening under the hood.
Important to stay in touch in the underlying project folder(especially if you manage joint
development and source control):
• So what do we have there now ?
• .idea folder – this is where pycharm stores it magic
• __pycache__ - this is where python caches the complied modules, read more here
http://stackoverflow.com/questions/2998215/if-python-is-interpreted-what-are-pyc-files
• Pycourse – the virtual env folder we used – Can you find PIL in there ?
• Our modules and package
• And a bunch of lena rotated images.
• Clean your work folder be fore we continue.
Google python classes
A great collection of python function you need to code, gradually covering
different python aspects while allowing you to test your code.
It contains some tutorials, Videos and exercises – we will focus on the exercises:
• More details @ https://developers.google.com/edu/python
The exercises have two parts:
• Basic, python modules that you need to “solve”
• Advanced, 3 small problems you need to code.
In the class we will focus on the basic, take as HW the advanced ones.
Setting our environment
• Create a new python project
• Add the basic subfolder into it
• Run string1.py, you have a bug fix it 
• Notice the print formatting in the files is different then the one we have seen so far. You can use both.
• The flow for each file:
• Module is running main(), what is the difference from what we did so far (calling main in the module)?
• Main calls test function with different inputs
• Each test is calling your function implementation, marking pass(OK)/fail (X) on console.
• You need to make it all pass , fail example :
• Lets start
String1.py
• You need to implement 4 strings manipulation functions:
• Each marked with letter (A,B,C,D).
• Each has instructions what is needed
• Each has a function signature
Solve all 4 functions, tips:
• Each module comes with reading page, read it.
• You can run it as many times as you want, work iteratively
• Google is your friend
• Use python console for fast experimenting
• Use debugger and break points and inspection.
• Combine both debugger and interactive –
Lets complete the rest
Complete rest of the modules, with the following order:
• String2
• List1, List2
• Wordcount
• If you got the time then go for mimic as well
Keep in mind every module has details in the google classes , strings details for
example :
https://developers.google.com/edu/python/strings
Recommendation for your next steps -
Recommended order
• Complete the advanced google execrcises
• Cover these shortly :docstrings, lambda functions, inheritance, getters and setter, decorators.
• Package your code using setuptools.
• Repeat the above using wheels.
• Learn about generators and iterators.
• Download and install miniconda package manager, install tensor flow using conda.
• Write multi-thread python program and see how fast it is:
• Network bounded – web page fetches.
• CPU bounded – count till 10^9
• Repeat the above using one of python multithread libs : twisted, gevent, async
• Learn how to use PYTHONPATH, write a pth file
• Install pip that requires build during install (like opencv)
• Write extension for python using c
• Use c extention from python
Just before we go – PEP20
The zen of python, use it as a mantra to an endless journey
Lets go over them.
1.Beautiful is better than ugly.
2.Explicit is better than implicit.
3.Simple is better than complex.
4.Complex is better than complicated.
5.Flat is better than nested.
6.Sparse is better than dense.
7.Readability counts.
8.Special cases aren't special enough to break the rules.
9.Although practicality beats purity.
10.Errors should never pass silently.
11.Unless explicitly silenced.
12.In the face of ambiguity, refuse the temptation to guess.
13.There should be one-- and preferably only one --obvious way to do it.
14.Although that way may not be obvious at first unless you're Dutch.
15.Now is better than never.
16.Although never is often better than *right* now.
17.If the implementation is hard to explain, it's a bad idea.
18.If the implementation is easy to explain, it may be a good idea.
19.Namespaces are one honking great idea -- let's do more of those!
eran.shlomo@intel.com

More Related Content

What's hot (20)

Python intro for Plone users
Python intro for Plone usersPython intro for Plone users
Python intro for Plone users
Carlos de la Guardia
 
A commercial open source project in Python
A commercial open source project in PythonA commercial open source project in Python
A commercial open source project in Python
jbrendel
 
AmI 2017 - Python intermediate
AmI 2017 - Python intermediateAmI 2017 - Python intermediate
AmI 2017 - Python intermediate
Luigi De Russis
 
Introduction to IPython & Notebook
Introduction to IPython & NotebookIntroduction to IPython & Notebook
Introduction to IPython & Notebook
Areski Belaid
 
开源沙龙第一期 Python intro
开源沙龙第一期 Python intro开源沙龙第一期 Python intro
开源沙龙第一期 Python intro
fantasy zheng
 
Picademy #3 Python Picamera GPIO Workshop
Picademy #3 Python Picamera GPIO WorkshopPicademy #3 Python Picamera GPIO Workshop
Picademy #3 Python Picamera GPIO Workshop
bennuttall
 
Learn raspberry pi programming with python
Learn raspberry pi programming with pythonLearn raspberry pi programming with python
Learn raspberry pi programming with python
SANTIAGO PABLO ALBERTO
 
A quick overview of why to use and how to set up iPython notebooks for research
A quick overview of why to use and how to set up iPython notebooks for researchA quick overview of why to use and how to set up iPython notebooks for research
A quick overview of why to use and how to set up iPython notebooks for research
Adam Pah
 
ZN-2015
ZN-2015ZN-2015
ZN-2015
Ivan Elkin
 
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
OhSoAwesomeGirl
 
Parallel programming using python
Parallel programming using python Parallel programming using python
Parallel programming using python
Samah Gad
 
LVPHP.org
LVPHP.orgLVPHP.org
LVPHP.org
Joshua Copeland
 
Data Science Salon: Deep Learning as a Product @ Scribd
Data Science Salon: Deep Learning as a Product @ ScribdData Science Salon: Deep Learning as a Product @ Scribd
Data Science Salon: Deep Learning as a Product @ Scribd
Formulatedby
 
Python setup for dummies
Python setup for dummiesPython setup for dummies
Python setup for dummies
Rajesh Rajamani
 
How to Make a Chatbot in Python | Edureka
How to Make a Chatbot in Python | EdurekaHow to Make a Chatbot in Python | Edureka
How to Make a Chatbot in Python | Edureka
Edureka!
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
Blue Elephant Consulting
 
The magic of IPython Notebook
The magic of IPython NotebookThe magic of IPython Notebook
The magic of IPython Notebook
Alexey Agapov
 
Thumbcoil: How we got here...
Thumbcoil: How we got here...Thumbcoil: How we got here...
Thumbcoil: How we got here...
Jon-Carlos Rivera
 
Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Infrastructure as code might be literally impossible / Joe Domato (packageclo...Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Ontico
 
Parallel Programming in Python: Speeding up your analysis
Parallel Programming in Python: Speeding up your analysisParallel Programming in Python: Speeding up your analysis
Parallel Programming in Python: Speeding up your analysis
Manojit Nandi
 
A commercial open source project in Python
A commercial open source project in PythonA commercial open source project in Python
A commercial open source project in Python
jbrendel
 
AmI 2017 - Python intermediate
AmI 2017 - Python intermediateAmI 2017 - Python intermediate
AmI 2017 - Python intermediate
Luigi De Russis
 
Introduction to IPython & Notebook
Introduction to IPython & NotebookIntroduction to IPython & Notebook
Introduction to IPython & Notebook
Areski Belaid
 
开源沙龙第一期 Python intro
开源沙龙第一期 Python intro开源沙龙第一期 Python intro
开源沙龙第一期 Python intro
fantasy zheng
 
Picademy #3 Python Picamera GPIO Workshop
Picademy #3 Python Picamera GPIO WorkshopPicademy #3 Python Picamera GPIO Workshop
Picademy #3 Python Picamera GPIO Workshop
bennuttall
 
Learn raspberry pi programming with python
Learn raspberry pi programming with pythonLearn raspberry pi programming with python
Learn raspberry pi programming with python
SANTIAGO PABLO ALBERTO
 
A quick overview of why to use and how to set up iPython notebooks for research
A quick overview of why to use and how to set up iPython notebooks for researchA quick overview of why to use and how to set up iPython notebooks for research
A quick overview of why to use and how to set up iPython notebooks for research
Adam Pah
 
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
Beginning nxt programming_workshop in Computer education robotics whoevgjvvvv...
OhSoAwesomeGirl
 
Parallel programming using python
Parallel programming using python Parallel programming using python
Parallel programming using python
Samah Gad
 
Data Science Salon: Deep Learning as a Product @ Scribd
Data Science Salon: Deep Learning as a Product @ ScribdData Science Salon: Deep Learning as a Product @ Scribd
Data Science Salon: Deep Learning as a Product @ Scribd
Formulatedby
 
Python setup for dummies
Python setup for dummiesPython setup for dummies
Python setup for dummies
Rajesh Rajamani
 
How to Make a Chatbot in Python | Edureka
How to Make a Chatbot in Python | EdurekaHow to Make a Chatbot in Python | Edureka
How to Make a Chatbot in Python | Edureka
Edureka!
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
Blue Elephant Consulting
 
The magic of IPython Notebook
The magic of IPython NotebookThe magic of IPython Notebook
The magic of IPython Notebook
Alexey Agapov
 
Thumbcoil: How we got here...
Thumbcoil: How we got here...Thumbcoil: How we got here...
Thumbcoil: How we got here...
Jon-Carlos Rivera
 
Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Infrastructure as code might be literally impossible / Joe Domato (packageclo...Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Ontico
 
Parallel Programming in Python: Speeding up your analysis
Parallel Programming in Python: Speeding up your analysisParallel Programming in Python: Speeding up your analysis
Parallel Programming in Python: Speeding up your analysis
Manojit Nandi
 

Viewers also liked (20)

Actividad 6 Tablas y esquemas en Powerpoint
Actividad 6 Tablas y esquemas en PowerpointActividad 6 Tablas y esquemas en Powerpoint
Actividad 6 Tablas y esquemas en Powerpoint
Esteban Mendez Peña
 
Actividad 2 Contaminación
Actividad 2 ContaminaciónActividad 2 Contaminación
Actividad 2 Contaminación
Esteban Mendez Peña
 
Actividad 4 Contaminación 2
Actividad 4 Contaminación 2Actividad 4 Contaminación 2
Actividad 4 Contaminación 2
Esteban Mendez Peña
 
Science1 اختبار علوم اوليمبياد
Science1 اختبار  علوم اوليمبيادScience1 اختبار  علوم اوليمبياد
Science1 اختبار علوم اوليمبياد
Mohamed Ragab Eltokhy
 
Math اختبار الرياضيات اولمبياد
Math اختبار الرياضيات اولمبيادMath اختبار الرياضيات اولمبياد
Math اختبار الرياضيات اولمبياد
Mohamed Ragab Eltokhy
 
Davison, kindra unit 9 assignment
Davison, kindra   unit 9 assignmentDavison, kindra   unit 9 assignment
Davison, kindra unit 9 assignment
K. D.
 
Plaquette huile alimentaire storage of edible oil
Plaquette huile alimentaire  storage of edible oilPlaquette huile alimentaire  storage of edible oil
Plaquette huile alimentaire storage of edible oil
Mohamed Larbi BEN YOUNES
 
SESION_CONFIANZA
SESION_CONFIANZASESION_CONFIANZA
SESION_CONFIANZA
Shanaiss
 
Proyecto ardillas explicación
Proyecto ardillas explicaciónProyecto ardillas explicación
Proyecto ardillas explicación
Mar Sánchez-Fortún
 
Imagine. Capture. Create. Interact
Imagine. Capture.Create. InteractImagine. Capture.Create. Interact
Imagine. Capture. Create. Interact
Eran Shlomo
 
Industrial internet of things
Industrial internet of thingsIndustrial internet of things
Industrial internet of things
Eran Shlomo
 
Internet of things - 2016 trends.
Internet of things - 2016 trends. Internet of things - 2016 trends.
Internet of things - 2016 trends.
Eran Shlomo
 
Intel and Amazon - Powering your innovation together.
Intel and Amazon - Powering your innovation together. Intel and Amazon - Powering your innovation together.
Intel and Amazon - Powering your innovation together.
Eran Shlomo
 
Manual de operador
Manual de operadorManual de operador
Manual de operador
lobosabio
 
Proyecto de construcción de un puente
Proyecto de construcción de un puenteProyecto de construcción de un puente
Proyecto de construcción de un puente
Juan Toledo González
 
Actividad 8
Actividad 8 Actividad 8
Actividad 8
Esteban Mendez Peña
 
Actividad 5 Elementos de las diapositivas
Actividad 5 Elementos de las diapositivasActividad 5 Elementos de las diapositivas
Actividad 5 Elementos de las diapositivas
Esteban Mendez Peña
 
Advanced Python : Static and Class Methods
Advanced Python : Static and Class Methods Advanced Python : Static and Class Methods
Advanced Python : Static and Class Methods
Bhanwar Singh Meena
 
Fundamentos de la administracion
Fundamentos de la administracionFundamentos de la administracion
Fundamentos de la administracion
charin22
 
OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017
Chris Tankersley
 
Actividad 6 Tablas y esquemas en Powerpoint
Actividad 6 Tablas y esquemas en PowerpointActividad 6 Tablas y esquemas en Powerpoint
Actividad 6 Tablas y esquemas en Powerpoint
Esteban Mendez Peña
 
Science1 اختبار علوم اوليمبياد
Science1 اختبار  علوم اوليمبيادScience1 اختبار  علوم اوليمبياد
Science1 اختبار علوم اوليمبياد
Mohamed Ragab Eltokhy
 
Math اختبار الرياضيات اولمبياد
Math اختبار الرياضيات اولمبيادMath اختبار الرياضيات اولمبياد
Math اختبار الرياضيات اولمبياد
Mohamed Ragab Eltokhy
 
Davison, kindra unit 9 assignment
Davison, kindra   unit 9 assignmentDavison, kindra   unit 9 assignment
Davison, kindra unit 9 assignment
K. D.
 
Plaquette huile alimentaire storage of edible oil
Plaquette huile alimentaire  storage of edible oilPlaquette huile alimentaire  storage of edible oil
Plaquette huile alimentaire storage of edible oil
Mohamed Larbi BEN YOUNES
 
SESION_CONFIANZA
SESION_CONFIANZASESION_CONFIANZA
SESION_CONFIANZA
Shanaiss
 
Imagine. Capture. Create. Interact
Imagine. Capture.Create. InteractImagine. Capture.Create. Interact
Imagine. Capture. Create. Interact
Eran Shlomo
 
Industrial internet of things
Industrial internet of thingsIndustrial internet of things
Industrial internet of things
Eran Shlomo
 
Internet of things - 2016 trends.
Internet of things - 2016 trends. Internet of things - 2016 trends.
Internet of things - 2016 trends.
Eran Shlomo
 
Intel and Amazon - Powering your innovation together.
Intel and Amazon - Powering your innovation together. Intel and Amazon - Powering your innovation together.
Intel and Amazon - Powering your innovation together.
Eran Shlomo
 
Manual de operador
Manual de operadorManual de operador
Manual de operador
lobosabio
 
Proyecto de construcción de un puente
Proyecto de construcción de un puenteProyecto de construcción de un puente
Proyecto de construcción de un puente
Juan Toledo González
 
Actividad 5 Elementos de las diapositivas
Actividad 5 Elementos de las diapositivasActividad 5 Elementos de las diapositivas
Actividad 5 Elementos de las diapositivas
Esteban Mendez Peña
 
Advanced Python : Static and Class Methods
Advanced Python : Static and Class Methods Advanced Python : Static and Class Methods
Advanced Python : Static and Class Methods
Bhanwar Singh Meena
 
Fundamentos de la administracion
Fundamentos de la administracionFundamentos de la administracion
Fundamentos de la administracion
charin22
 
OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017
Chris Tankersley
 
Ad

Similar to PyCourse - Self driving python course (20)

Introduction to python 3
Introduction to python 3Introduction to python 3
Introduction to python 3
Youhei Sakurai
 
Introduction to python 3 2nd round
Introduction to python 3   2nd roundIntroduction to python 3   2nd round
Introduction to python 3 2nd round
Youhei Sakurai
 
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
gustyyrauan
 
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
benhurmaarup
 
What is python
What is pythonWhat is python
What is python
EU Edge
 
Python ppt
Python pptPython ppt
Python ppt
Mohita Pandey
 
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
Bhavsingh Maloth
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
Dozie Agbo
 
05 python.pdf
05 python.pdf05 python.pdf
05 python.pdf
SugumarSarDurai
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
MohammadSamiuddin10
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
MohammadSamiuddin10
 
Session-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptxSession-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptx
WajidAliHashmi2
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
Gnanesh12
 
Python PPT.pptx
Python PPT.pptxPython PPT.pptx
Python PPT.pptx
JosephMuez2
 
What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)
wesley chun
 
Introduction to Python For Diploma Students
Introduction to Python For Diploma StudentsIntroduction to Python For Diploma Students
Introduction to Python For Diploma Students
SanjaySampat1
 
Introduction to python.pptx
Introduction to python.pptxIntroduction to python.pptx
Introduction to python.pptx
pcjoshi02
 
Lecture 2 introduction to python
Lecture 2  introduction to pythonLecture 2  introduction to python
Lecture 2 introduction to python
alvin567
 
Python Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & stylePython Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & style
Kevlin Henney
 
Mastering the Interview: 50 Common Interview Questions Demystified
Mastering the Interview: 50 Common Interview Questions DemystifiedMastering the Interview: 50 Common Interview Questions Demystified
Mastering the Interview: 50 Common Interview Questions Demystified
MalcolmDupri
 
Introduction to python 3
Introduction to python 3Introduction to python 3
Introduction to python 3
Youhei Sakurai
 
Introduction to python 3 2nd round
Introduction to python 3   2nd roundIntroduction to python 3   2nd round
Introduction to python 3 2nd round
Youhei Sakurai
 
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
gustyyrauan
 
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
benhurmaarup
 
What is python
What is pythonWhat is python
What is python
EU Edge
 
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
Bhavsingh Maloth
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
Dozie Agbo
 
Session-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptxSession-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptx
WajidAliHashmi2
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
Gnanesh12
 
What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)
wesley chun
 
Introduction to Python For Diploma Students
Introduction to Python For Diploma StudentsIntroduction to Python For Diploma Students
Introduction to Python For Diploma Students
SanjaySampat1
 
Introduction to python.pptx
Introduction to python.pptxIntroduction to python.pptx
Introduction to python.pptx
pcjoshi02
 
Lecture 2 introduction to python
Lecture 2  introduction to pythonLecture 2  introduction to python
Lecture 2 introduction to python
alvin567
 
Python Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & stylePython Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & style
Kevlin Henney
 
Mastering the Interview: 50 Common Interview Questions Demystified
Mastering the Interview: 50 Common Interview Questions DemystifiedMastering the Interview: 50 Common Interview Questions Demystified
Mastering the Interview: 50 Common Interview Questions Demystified
MalcolmDupri
 
Ad

Recently uploaded (20)

Leveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer IntentsLeveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer Intents
Keheliya Gallaba
 
Who will create the languages of the future?
Who will create the languages of the future?Who will create the languages of the future?
Who will create the languages of the future?
Jordi Cabot
 
OpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native BarcelonaOpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native Barcelona
Imma Valls Bernaus
 
Essentials of Resource Planning in a Downturn
Essentials of Resource Planning in a DownturnEssentials of Resource Planning in a Downturn
Essentials of Resource Planning in a Downturn
OnePlan Solutions
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FMEIntegrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - IntroductionIBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink TemplateeeeeeeeeeeeeeeeeeeeeeeeeeNeuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
alexandernoetzold
 
Automating Map Production With FME and Python
Automating Map Production With FME and PythonAutomating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
FME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable InsightsFME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable Insights
Safe Software
 
Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025
Orangescrum
 
Revolutionize Your Insurance Workflow with Claims Management Software
Revolutionize Your Insurance Workflow with Claims Management SoftwareRevolutionize Your Insurance Workflow with Claims Management Software
Revolutionize Your Insurance Workflow with Claims Management Software
Insurance Tech Services
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchAgentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
Providing Better Biodiversity Through Better Data
Providing Better Biodiversity Through Better DataProviding Better Biodiversity Through Better Data
Providing Better Biodiversity Through Better Data
Safe Software
 
Key AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence CompaniesKey AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence Companies
Mypcot Infotech
 
Artificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across IndustriesArtificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across Industries
SandeepKS52
 
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...
WSO2
 
Bonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdfBonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdf
Herond Labs
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Leveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer IntentsLeveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer Intents
Keheliya Gallaba
 
Who will create the languages of the future?
Who will create the languages of the future?Who will create the languages of the future?
Who will create the languages of the future?
Jordi Cabot
 
OpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native BarcelonaOpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native Barcelona
Imma Valls Bernaus
 
Essentials of Resource Planning in a Downturn
Essentials of Resource Planning in a DownturnEssentials of Resource Planning in a Downturn
Essentials of Resource Planning in a Downturn
OnePlan Solutions
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FMEIntegrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - IntroductionIBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink TemplateeeeeeeeeeeeeeeeeeeeeeeeeeNeuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
alexandernoetzold
 
Automating Map Production With FME and Python
Automating Map Production With FME and PythonAutomating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
FME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable InsightsFME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable Insights
Safe Software
 
Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025
Orangescrum
 
Revolutionize Your Insurance Workflow with Claims Management Software
Revolutionize Your Insurance Workflow with Claims Management SoftwareRevolutionize Your Insurance Workflow with Claims Management Software
Revolutionize Your Insurance Workflow with Claims Management Software
Insurance Tech Services
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchAgentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
Providing Better Biodiversity Through Better Data
Providing Better Biodiversity Through Better DataProviding Better Biodiversity Through Better Data
Providing Better Biodiversity Through Better Data
Safe Software
 
Key AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence CompaniesKey AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence Companies
Mypcot Infotech
 
Artificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across IndustriesArtificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across Industries
SandeepKS52
 
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...
WSO2
 
Bonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdfBonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdf
Herond Labs
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 

PyCourse - Self driving python course

  • 1. Eran Shlomo, Intel perceptual computing [email protected] ©
  • 2. About me Haifa IoT Ignition lab and IPP(Intel ingenuity partnership program) tech lead. Intel Perceptual computing. Python expert, started around 2009 with silicon analytics. Focus on Data science and Machine learning in recent years (A lot of python).
  • 3. About the PyCourse Self driving course  Just follow the slides, it is built both for self work as well as class work. If you are not in class make sure to read the attached references and links. If you are in class then read them later.
  • 4. Why do you want to learn python ? • Very fast prototyping. • Cross platform. • Rich libraries and capabilities. • Good interactive/console experience. • Fast engine (in script land) • The leading language in AI world. • More on The good, The bad and the ugly of python can be found here: https://www.slideshare.net/EranShlomo/python-the-good-the-bad-and-the-ugly
  • 5. Before we start • Download and Install python 2.7 • Download, do not install : • Download, python 3.5, pycharm, miniconda and google python classes.
  • 6. Hello world • Lets check we have python installed and good to go: • Go to the folder you have extracted the course package zip, lets call it our working dir • Open cmd in your working dir and check python is functional and in the right (2.7.12) version: • If no python update your path, if version is incorrect change path variable order, you can check its properly configured using where : Lets make a simple hello world file and run it, create a file called hello.py and put in it a single line printing hello: • print "hello pycourse“ • Save and run it in cmd console: • python hello.py • No python, in cmd type : set PATH=C:Python27;%PATH%
  • 7. Python versions Python versions have significant importance, Python world struggles to move between versions and there are many compatibility issues. Lets run our script on python 3: • Install python 3.5.2 • Open cmd on working dir • Set python 3 path to take priority :set PATH=<python 3 path>;%PATH% • Run python - - version and make sure python version is right. • Run our hello: fails …. Fix it: • In python 3 print is no longer statement but function , many more differences… • See more : http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html
  • 8. Packaging Python packing is pretty messy with a lot of ambiguity, today in python community the two leading ones are: • Easy_install – 2004, python first significant attempt to supply packaging mechanism • Pip – 2008, alternative to easy_install and the common one as of today. For more details : https://packaging.python.org/pip_easy_install/ There are two main aspect to packaging: • I want to use packages in my project • I want to package my project for others – out of this course scope. Lets install a package, virtualenv: • In command line, working dir (we are still in python 3) type: pip install virtualenv
  • 9. Our python root Being familiar with your python root structure is very important, many times debug will take you there. Lets look for our virtualenv package install: • Go to python home, reminder where python will show you home. • Under Lib you will find the packages and models (later on difference) that comes with install. You will also find a folder called site-packages - our freshly installed virtualenv package is there. • Any packages we install will go there as well, which becomes pretty messy after a while as different project requires different packages and versions.
  • 10. Virtual environments In order to allow developers easily develop between versions (many times you need to work on many different version on the same machine) we have virtualenv package. More details : http://docs.python-guide.org/en/latest/dev/virtualenvs/ This package allows you to create an isolated python environments, each with its own dependencies and navigate between them. Lets create virtural environment: • In our work dir type in console :virtualenv pycourse • This creates virtual environment with the name pycourse, and installs base python + setuptools into it, notice virtual env folder was created under sub dir pycourse • Activate the virtualenv , in cmd type : .pycourseScriptsactivate • And now deactivate it , in cmd type : .pycourseScriptsdeactivate
  • 11. Module and packages • Python has two main mechanisms for managing code blocks: modules and packages. Both are almost the same conceptually, packages allows you to create more complex file structures and name spaces: • Module – single .py file • Package – directory with __init__.py in it, can conatain sub packages. Lets create an hello module and run it :  create a file called hello_mod.py with the code, print ("hello pycourse module”)  Create a subfolder called hello_pack, inside it create a file called __init__.py with the code, print ("hello pycourse package ”)  create a file called main.py with the following :  Run main.py :  Read more on the matter http://knowpapa.com/modpaclib-py/
  • 12. Function Lets make a function in hello mod: • Python uses indentation as block, use 4 spaces for every block. Indentation rules can be found here but keeping in mind 4 spaces in what usually is {}: • Using Ide usually takes care of that for you easily. • http://www.peachpit.com/articles/article.aspx?p=1312792&seqNum=3 Add function to hello_mod.py so it look like: Lets run it, this time in console: run python in cmd, this will get you into interactive interpreter mode. Now you can code directly into the interpreter. Import the module and call the function: . . .
  • 13. Time to IDE Once we go into more coding IDE becomes extremely usefull, There are many IDEs out there, we will be using JetBrains Pycharm, install it (download or take from course distribution). Lets create a project with our code: • File Create new project • Put location of your work dir, choose interpreter of your python 3.5.2 install. • • Pycharm will warn on existing code, confirm it – it will create project with your code. • Run main on ide, now run menu is empty : • Right click main.py and click run main: • And now run menu is active, with main as default run config: • Put a breakpoint in the hello function and click debug : • Debug button :
  • 14. Classes So we have an IDE working, pycharm is a great distribution of eclipse & pydev, so if you are coming from JAVA you might feel at home pretty fast. Python have two type of classes : classic and new style, always use the new style, notice the pass keyword: More on pass: https://www.tutorialspoint.com/python/python_pass_statement.htm More on class stype differences: http://stackoverflow.com/questions/54867/what-is-the-difference-between-old-style-and-new-style- classes-in-python Create an hello class inside hello_mod, new style as follows: notice the self reference, it’s the python equivalent of this Run main in pycharm and see in output console the result CLASSIC NEW
  • 15. Wrapping point – short exercise Build an image class rotator, Using the pillow package. Do the following: • Install the Pillow package • Build a class rotator with the following methods: • Load – load an image to the rotator, parameter :im_path • Rotate – rotate the image , parameter :rotation • save– saves the currently rotated image, parameter :im_path • Run the following code using your class and lena.jpg (inside project package, or choose image of your choice) to get rotated images: • Take the time to understand the code, first time we see loop and string formatting
  • 16. PEPs Python is developed and progress using PEPs, Python Enhancements Proposal This is how community decides on language future and features, PEP0 contains the full list: https://www.python.org/dev/peps/ As you are becoming python programmer, let go over PEP8: • Authored by Guido, contains the “right syntax style” to python. • Stick to PEP8 • PyCharm actually mark you where you got it wrong: • Two violations here, import not on top, missing two blank lines. • Nice feature : PyCharm contains auto fix under CodeReformat code Read PEP20, we will get back to it later  - https://www.python.org/dev/peps/pep-0020/
  • 17. Time to revisit our project folder So while we are inside our nice and cozy IDE stuff is happening under the hood. Important to stay in touch in the underlying project folder(especially if you manage joint development and source control): • So what do we have there now ? • .idea folder – this is where pycharm stores it magic • __pycache__ - this is where python caches the complied modules, read more here http://stackoverflow.com/questions/2998215/if-python-is-interpreted-what-are-pyc-files • Pycourse – the virtual env folder we used – Can you find PIL in there ? • Our modules and package • And a bunch of lena rotated images. • Clean your work folder be fore we continue.
  • 18. Google python classes A great collection of python function you need to code, gradually covering different python aspects while allowing you to test your code. It contains some tutorials, Videos and exercises – we will focus on the exercises: • More details @ https://developers.google.com/edu/python The exercises have two parts: • Basic, python modules that you need to “solve” • Advanced, 3 small problems you need to code. In the class we will focus on the basic, take as HW the advanced ones.
  • 19. Setting our environment • Create a new python project • Add the basic subfolder into it • Run string1.py, you have a bug fix it  • Notice the print formatting in the files is different then the one we have seen so far. You can use both. • The flow for each file: • Module is running main(), what is the difference from what we did so far (calling main in the module)? • Main calls test function with different inputs • Each test is calling your function implementation, marking pass(OK)/fail (X) on console. • You need to make it all pass , fail example : • Lets start
  • 20. String1.py • You need to implement 4 strings manipulation functions: • Each marked with letter (A,B,C,D). • Each has instructions what is needed • Each has a function signature Solve all 4 functions, tips: • Each module comes with reading page, read it. • You can run it as many times as you want, work iteratively • Google is your friend • Use python console for fast experimenting • Use debugger and break points and inspection. • Combine both debugger and interactive –
  • 21. Lets complete the rest Complete rest of the modules, with the following order: • String2 • List1, List2 • Wordcount • If you got the time then go for mimic as well Keep in mind every module has details in the google classes , strings details for example : https://developers.google.com/edu/python/strings
  • 22. Recommendation for your next steps - Recommended order • Complete the advanced google execrcises • Cover these shortly :docstrings, lambda functions, inheritance, getters and setter, decorators. • Package your code using setuptools. • Repeat the above using wheels. • Learn about generators and iterators. • Download and install miniconda package manager, install tensor flow using conda. • Write multi-thread python program and see how fast it is: • Network bounded – web page fetches. • CPU bounded – count till 10^9 • Repeat the above using one of python multithread libs : twisted, gevent, async • Learn how to use PYTHONPATH, write a pth file • Install pip that requires build during install (like opencv) • Write extension for python using c • Use c extention from python
  • 23. Just before we go – PEP20 The zen of python, use it as a mantra to an endless journey Lets go over them.
  • 24. 1.Beautiful is better than ugly. 2.Explicit is better than implicit. 3.Simple is better than complex. 4.Complex is better than complicated. 5.Flat is better than nested. 6.Sparse is better than dense. 7.Readability counts. 8.Special cases aren't special enough to break the rules. 9.Although practicality beats purity. 10.Errors should never pass silently. 11.Unless explicitly silenced. 12.In the face of ambiguity, refuse the temptation to guess. 13.There should be one-- and preferably only one --obvious way to do it. 14.Although that way may not be obvious at first unless you're Dutch. 15.Now is better than never. 16.Although never is often better than *right* now. 17.If the implementation is hard to explain, it's a bad idea. 18.If the implementation is easy to explain, it may be a good idea. 19.Namespaces are one honking great idea -- let's do more of those!