Index \ Java \ ActionScript \ Lingo \ Python \ Design By Numbers


Python is considered to be an excellent teaching language because of its clear syntax and structure. Python is typically used for non-graphic applications. It doesn't have a native graphics library, but graphics applications may be created by using graphics toolkits, some of which are cross-platform.

Python is the product of a community effort, rather than a corporate project. Python was originated by the benevolent dictator Guido van Rossum. The language is characterized by a small syntax and huge variety of modules which extend the possibilities of the language. More information is available at http://www.python.org
Processing Python
int x = 70; // Initialize
x = 30; // Change value
x = 70 # Initialize
x = 30 # Change value
float x = 70.0;
x = 30.0;
x = 70.0
x = 30.0
int[] a = {5, 10, 11}; // Create an array
a[0] = 12; // Reassign

# For this simple comparison, a "list" in python
# may be used like the "array" example in
# in Processing shown to the left. A "list" in python
# is more similar to a Vector in Java than a
# primitive array
a = [5, 10, 11] # Create a list
a[0] = 12 # Reassign

Processing Python
void draw() {
// Statements
}
while 1:
# Statements
for(int a=45; a<=55; a++) {
// Statements
}
for a in range(45, 55):
# Statements
if(c==1) {
// Statements
}
if c == 1:
# Statements
if(c!=1) {
// Statements
}
if c != 1:
# Statements
if(c < 1) {
// Statements
}
if c < 1:
# Statements
if(c >= 1) {
// Statements
}
if c >= 1:
# Statements
if((c >= 1) && (c < 20)) {
// Statements
}
if c >= 1 and c < 20:
# Statements

if(c >= 20) {
// Statements 1
} else if (c == 0) {
// Statements 2
} else {
// Statements 3
}

if c >= 20:
# Statements
elif x == 0:
# Statements
else:
# Statements

Processing >> Python by REAS, Walter Aprile, jc-denton, toxi