introduction to python programming - usth moodle
TRANSCRIPT
Python Get started
Introduction to Python Programming
Tran Giang Son, [email protected]
ICT Department, USTH
Introduction to Python Programming Tran Giang Son, [email protected] 1 / 25
Python Get started
Python
Introduction to Python Programming Tran Giang Son, [email protected] 2 / 25
Python Get started
What
• Programming language• Open-source
• Interpreted
• High-level
• General-purpose
• Code readability
• Object Oriented Programming
Introduction to Python Programming Tran Giang Son, [email protected] 4 / 25
Python Get started
What
SourceIntroduction to Python Programming Tran Giang Son, [email protected] 5 / 25
Python Get started
What
Source
Introduction to Python Programming Tran Giang Son, [email protected] 6 / 25
Python Get started
Why
• Easy
• Flexible
• Readability
• Projects
• Jobs
Introduction to Python Programming Tran Giang Son, [email protected] 7 / 25
Python Get started
Why: Easy
• Syntax
• Natural
• Intuitive
• Python:
print("Hello world.")
• Java:
public class Test {public static void main(String args[]) {
System.out.println("Hello world.");}
}
Introduction to Python Programming Tran Giang Son, [email protected] 8 / 25
Python Get started
Why: Flexible
• Script
• Backend
• Machine Learning, Deep Learning
• Apps• Mobile
• Desktop
• Web
Introduction to Python Programming Tran Giang Son, [email protected] 9 / 25
Python Get started
Why: Readability
• Indents ftw!
• Line breaks ftw!
Introduction to Python Programming Tran Giang Son, [email protected] 10 / 25
Python Get started
Why: Projects
• Full list• Browser
• Youtube-dl
• Music Player
• Video Editor
• Bittorent client
• Text Editor
Introduction to Python Programming Tran Giang Son, [email protected] 11 / 25
Python Get started
Why: Jobs!1!!
Introduction to Python Programming Tran Giang Son, [email protected] 12 / 25
Python Get started
Why: Jobs!1!!
Introduction to Python Programming Tran Giang Son, [email protected] 13 / 25
Python Get started
Why: Jobs!1!!
Introduction to Python Programming Tran Giang Son, [email protected] 14 / 25
Python Get started
Why: Jobs!1!!
Introduction to Python Programming Tran Giang Son, [email protected] 15 / 25
Python Get started
Why
That’s 4 ECTS btw. . .
Introduction to Python Programming Tran Giang Son, [email protected] 16 / 25
Python Get started
Why NOT?
• Intepretation, not compilation
• Slow• GIL. . .
• Not optimized for• Mobile
• Web client
Introduction to Python Programming Tran Giang Son, [email protected] 17 / 25
Python Get started
Get started
Introduction to Python Programming Tran Giang Son, [email protected] 18 / 25
Python Get started
Python
• Python• Python 2.x: discontinued
• Python 3.x
• Download
Introduction to Python Programming Tran Giang Son, [email protected] 19 / 25
Python Get started
Versions, Environments, Packages
Introduction to Python Programming Tran Giang Son, [email protected] 20 / 25
Python Get started
Versions, Environments, Packages
• pyenv: manage Python versions
• virtualenv: isolate Python environments
• pip:• install Python packages
• from Python Package Index
• conda:• isolate environments
• install packages
• miniconda: minimal installer for conda
• anaconda: miniconda + bunch of pre-installed packages
Introduction to Python Programming Tran Giang Son, [email protected] 21 / 25
Python Get started
IDE• Full fledged IDEs
• PyCharm
• Visual Studio Code
• Better live code• Jupyter notebooks
• Spyder
• Simplicity: any text editor• Atom
• Sublime Text
• Notepad
• vi/vim/nano. . .Introduction to Python Programming Tran Giang Son, [email protected] 22 / 25
Python Get started
Jupyter Notebook
• Written in Python
• Fork of IPython
• Open-source Web app• live code
• equations
• Computational output - visualizations
• explanatory text
• Popular for Data Science
• JupyterLab
Introduction to Python Programming Tran Giang Son, [email protected] 23 / 25
Python Get started
Jupyter Notebook
• Main components• IPython
• ØMQ
• Tornado (web server)
• jQuery
• Bootstrap (front-end framework)
• MathJax
Introduction to Python Programming Tran Giang Son, [email protected] 24 / 25
Python Get started
Jupyter Notebook
• Install• pip
pip install notebook
* conda
conda install -c conda-forge notebook
• Launch
jupyter notebook
Introduction to Python Programming Tran Giang Son, [email protected] 25 / 25