Top Banner
Intro to Python Intro to Python Programming Programming (Introduction) (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at. 1
13

Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

Dec 27, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

Intro to Python ProgrammingIntro to Python Programming(Introduction)(Introduction)

Pamela A. MooreZenia C. BahorskiEastern Michigan UniversityMarch 7, 2012

A language to swear by, not at.1

Page 2: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

Intro to Python ProgrammingIntro to Python ProgrammingAbstract…Abstract…

One of the new programming languages sweeping both education and practice is Python. This language is very intuitive while still being quite powerful. Python would be the perfect vehicle to teach programming in the secondary school before tackling Java. It has the added advantage of being freely available for both Mac and PC platforms. This session will instruct participants in how to create Python programs that can be used for general programming and scripting. Participants will receive a flash drive with all needed files pre-loaded. The course presupposes no familiarity with programming, but it would be helpful.

http://people.emich.edu/zbahorski 2

Page 3: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

Topics Covered in Part 1Topics Covered in Part 1History of Python“What is” Python?Python License AgreementWhere to Get PythonHow to Install PythonHow to Program in Python

3

Page 4: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

History of PythonHistory of Python Guido van Rossum (History at:

http://docs.python.org/license.html)◦ Began as a Christmas break “hobby” in 1989

Chose the name Python after the BBC comedy troupe Monty Python’s Flying Circus.

Inspiration: ABC, Modula-3, with a smattering of C Van Rossum helped create ABC, a teaching language, in the early 1980’s

(Foreword for “Programming Python” para. 4).

◦ Feb. 1990: First version distributed while at CWI◦ 1995: Corporation for National Research Initiatives, Reston,

Virginia ◦ May 2000: van Rossum and development team moved to

BeOpen.com (PythonLabs team)◦ October 2000: PythonLabs team moved to Digital Creations (now

Zope Corporation)◦ Now: at Google.com

All versions were Open Source Latest versions: 2.7.1 & 3.2 (flash drives) Visualization of Python Project (contributors):

◦ http://vimeo.com/1093745 4

Page 5: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

What is Python?What is Python? Python.org “Executive Summary”:

◦ Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.

◦ Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.

◦ Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance.

◦ Python supports modules and packages, which encourages program modularity and code reuse.

◦ The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.

◦ http://www.python.org/doc/essays/blurb.html5

Page 6: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

What is Python?What is Python?Some of its key distinguishing features include:

◦ very clear, readable syntax◦ strong introspection capabilities◦ intuitive object orientation◦ natural expression of procedural code◦ full modularity, supporting hierarchical packages◦ exception-based error handling◦ very high level dynamic data types◦ extensive standard libraries and third party modules

for virtually every task◦ extensions and modules easily written in C, C++ (or

Java for Jython, or .NET languages for IronPython)◦ embeddable within applications as a scripting

interface

6

Page 7: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

What is Python?What is Python?Operating Systems:

◦Windows◦Linux/Unix◦OS/2◦Mac◦Amiga◦among others. ◦There are even versions that run on

.NET Java virtual machine Nokia Series 60 cell phones

7

Page 8: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

Python License AgreementPython License AgreementFREE and Open Source!FREE and Open Source! This LICENSE AGREEMENT is between the Python Software

Foundation (“PSF”), and the Individual or Organization (“Licensee”) accessing and otherwise using Python 2.7.1 software in source or binary form and its associated documentation.

Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 2.7.1 alone or in any derivative version, provided, however, that PSF’s License Agreement and PSF’s notice of copyright, i.e., “Copyright © 2001-2010 Python Software Foundation; All Rights Reserved” are retained in Python 2.7.1 alone or in any derivative version prepared by Licensee.

In the event Licensee prepares a derivative work that is based on or incorporates Python 2.7.1 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python 2.7.1.

8

Page 9: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

Where to Get PythonWhere to Get Pythonhttp://python.org/download/Python 2.7.2 or Python 3.2.2

◦Both are “considered stable”◦Macs & those writing 3rd party software

use 2.7.2 (compatibility issues!)◦All library updates will happen to 3.x

◦BUT >>> PC version of Python >> You need to be familiar with paths! >>> Alternative >>

◦(See next page)9

Page 10: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

How to Install PythonHow to Install PythonGreat, FAST, Installation

instructions at:◦http://www.richarddooling.com/

index.php/2006/03/14/python-on-xp-7-minutes-to-hello-world/

◦Gives great directions and link to: ActiveState:

ActiveState:◦http://www.activestate.com/

activepython/downloads

10

Page 11: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

How to Install PythonHow to Install PythonWe downloaded the program file

to the flash drive (from ActiveState)

Double-click on the filename will automatically start the install wizard◦Keep clicking next for default install

until done◦Install is complete

11

Page 12: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

How to Install PythonHow to Install PythonWhere did Python go?

◦Start >> ◦ All Programs >> ◦ ActiveState ActivePython 2.7 (32

bit) >>◦ IDLE (Python GUI)

You are Ready to speak “Parseltongue”

12

Page 13: Intro to Python Programming (Introduction) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at.

How to Program in PythonHow to Program in PythonOn to Programming in Python…

13