chapter 1: python basics csci-ua 0002 – introduction to computer programming mr. joel kemp

9
Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp

Upload: diana-hoover

Post on 24-Dec-2015

219 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp

Chapter 1: Python Basics

CSCI-UA 0002 – Introduction to Computer ProgrammingMr. Joel Kemp

Page 2: Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp

Agenda

• What is Python?• How do we get it?• How do we execute our programs?

This material can be found in Chapter 3 of the Visual Quickstart Guide

Page 3: Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp

What is Python?• A programming language that emphasizes

readable code!– Combines power with clear syntax.– Interpreted not compiled!

• Why are we using it?– Very beginner friendly!– Beginners shouldn’t be burdened with syntax.• Semicolons, braces, pointers, datatype declarations.• Increases programmer productivity.

Page 4: Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp

From Design to Interpretation

Page 5: Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp

Installing Python

• Visit python.org/download– For Windows Users: Python 3.2

Windows x86 MSI installer– For Mac Users: Python 3.2 64-

bit/32-bit Installer• Run the downloaded installer

and complete the installation process.

Page 6: Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp

Before We Start• Python code is placed in a regular text file that must end with

the .py extension. – Can be written in any plain text editor :

• Notepad, Notepad++ (Windows)• TextEdit, TextWrangler (Mac OSX)

– Avoid using Wordpad and Microsoft Word!

• Integrated Development Environment (IDE)– Definition: a large computer program that provides tools for

increasing productivity in software development.– Tools:

• Intellisense/Auto-Completion• Real-time error-checking• Debugging• Compiler and/or Interpreter

– We’ll be using the IDLE IDE!

Page 7: Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp

IDLE IDE• Included with the Python Installation!• Written in Python!• Allows us to bypass running python files from the

command line!

Page 8: Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp

Running a Python File (Command Line)1. Open the command prompt or terminal.2. Navigate to the location of the python file:– Use the cd command to access folders.– Use the cd command with two periods (cd ..) to

move backward in the filesystem.

3. To run/interpret the python file:– Type python filename.py (where filename is

the file you’re trying to run)

Page 9: Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp

Running a Python File (IDLE)1. Create a new file or open an existing python file.2. Click on the Run Module button in the Run

menu!