Python Notes

Only available on StudyMode
  • Topic: C, For loop, Variable
  • Pages : 70 (10999 words )
  • Download(s) : 111
  • Published : December 8, 2012
Open Document
Text Preview
Programming with Python
Chapter One
Introducing Python
* Powerful yet easy to use programming language
* Developed by Guido van Rossum
* First released in 1991
* Named after comedy troupe Monty Python
* An alarming number of references to spam, eggs, and the number 42 in documentation

Why Python? It’s Easy to Use

* High-level language: Distinct from the low-level processor operations; closer to human language than machine language * "Programming at the speed of thought"
* Increases productivity
* Python programs three to five times shorter than Java * Python programs five to ten times shorter than C++
* Normally, “Programming is like making fine furniture with an axe and a nail file.” * Python makes it more like working with a table saw & a lathe * You still have to learn how to use them, but they’re the right tools for the job

Python Is Easy to Use

* Python Program
print "Game Over!"
* C++ Program
#include <iostream>
int main()
{
std::cout << "Game Over!" << std::endl;
return 0;
}

Python Is Powerful

* Used by large organizations
* NASA
* Google
* Microsoft
* Used in published games
* Battlefield 2
* Civilization IV
* Disney’s Toontown Online
* Used throughout academia and the scientific community

Python Is Object-Oriented

* Object-oriented programming (OOP): Methodology that defines problems in terms of objects that send messages to each other * In a game, a Missile object could send a Ship object a message to Explode * OOP not required, unlike Java and C#

Python Is a “Glue” Language

* Can be integrated with other languages
* C/C++
* Java
* Use existing code
* Leverage strengths of other languages
* Extra speed that C or C++ offers

Python Runs Everywhere

* Platform independent: Independent of the specific computer operating system * Python runs on
* Windows
* DOS
* Mac OS X
* Linux
* Many more

Python Has a Strong Community

* As an approachable language, has approachable community * Python Tutor mailing list
* http://mail.python.org/mailman/listinfo/tutor
* Perfect for beginners
* No actual "tutors" or "students"

Python Is Free and Open Source

* Open source: Publicly available; open source software typically programmed by volunteers; anyone can use source code without fee * Can modify or even resell Python
* Embracing open-source ideals is part of what makes Python successful

Python is Popular

* All those advantages make Python a commonly used (and liked) language Java
C
C++
Javascript
PHP
Python………
SQL
Perl
C#

(http://www.langpop.com/):
Installing Python

* Do NOT install anything from the textbook’s CD-ROM
* Instead, follow the instructions on the class web page
* Don’t have to worry about PyGame & LiveWires yet * Windows
* Go to http://www.python.org/download/
* Download the latest “standard” (aka “production”) release installer (.msi file) --e.g. Python 2.6.4 * Double-click the installer program and follow its instructions to install Python on your boot (C:) drive * Linux

* Python probably already installed
* Test: try running python at command prompt
* If not installed, go to http://www.python.org/download/ (you will probably need to build from source) * Mac OS X
* For 10.5.x or 10.6.x follow the instructions on the class web site (install Enthought Python Distribution and replace IDLE) * For earlier versions download appropriate version from Python web site at http://www.python.org/download/

Introducing IDLE
* Integrated Development Environment (IDE): Application that helps software developers write programs * Like a word processor for your code
* IDLE is the IDE that...
tracking img