Professional Documents
Culture Documents
Introduction to
Programming &
Python
Brandon Krakowsky
What is Programming?
• A program is a collection of instructions that performs a specific task (or set of tasks) when
executed
• Programming is a way of specifying (or writing) the instructions
• Programming languages vary in many ways:
- Syntax: Structure or grammar of the language
- Semantics: Meaning of the code. What will it do when I run it?
- Speed
- Memory management
- Etc.
1
03-10-2020
What is Python?
• Python was named after the TV show Monty Python’s Flying Circus
• Python is a high-level programming language
- Provides abstraction from the details of the computer
• Does most of the work in communicating with the computer
• The code is intuitive and easy to understand
• Python is an object-oriented programming (OOP) language
- Organized around objects rather than “actions”
What is Python?
• Python is an interpreted programming language
- Does not need to be compiled
• Does not need to be converted from one language to another
• For example: Java
- Is interpreted by a Python interpreter
• It’s small and can run on any kind of computer!
- This means that sometimes it’s difficult to debug your Python programs
• Do not make the mistake of typing out large chunks of code and not testing it at all
Why Python?
• Python is an open source programming language
- It’s free!
• Python is powerful, flexible, and intuitive
- There are many Python libraries and resources available online
- Closely resembles the English language
• Python is good for beginners and a great foundation for other languages!
• Python can be used for:
- Artificial intelligence/machine learning/natural language processing
- Web development
- Data analysis & visualization
- Game programming
- Desktop GUIs
- Many other purposes!
2
03-10-2020
Download/Installing Python
• We will be using Python 3 in this course
- If you already have Python 2 installed, please upgrade to Python 3
• To download and install Python, go here: https://www.python.org/downloads/ (Download the
latest version)
• This download/install comes bundled with IDLE (Python’s Integrated Development and Learning
Environment)
- Includes an interactive Python interpreter and script editor
- We’ll eventually be using IDLE to write and run Python scripts
Jupyter Notebook
• For today, we’ll use Jupyter Notebook to write and run Python code
• Jupyter Notebook runs in a browser on your computer
- Includes interactive Python interpreter and script editor
- To install, download Anaconda, a data science platform. This will install Python and Jupyter
Notebook all at once: https://www.anaconda.com/download (Download the latest version)
- To run, open Terminal on Mac or Command Prompt on Windows and run: jupyter notebook
- Or launch from the Anaconda Navigator
3
03-10-2020
10
11
12
4
03-10-2020
13
Python Language
14
Note: Commands in light blue can be typed directly into a Jupyter Notebook file
15
5
03-10-2020
16
17
18
6
03-10-2020
19
20
21
7
03-10-2020
22
23
24
8
03-10-2020
25
26