diff options
author | C. Scott Ananian <cscott@laptop.org> | 2007-12-11 09:24:34 (GMT) |
---|---|---|
committer | C. Scott Ananian <cscott@laptop.org> | 2007-12-11 09:24:34 (GMT) |
commit | 9df72c5591aee015089a4e96f9403183262dcc01 (patch) | |
tree | 4a01e662068fe7977dbb4fd14e232fc7354863d4 /data/math | |
parent | 90c54afd7ea81be376b078eb08b87e4f20e71dcf (diff) |
Factor out a pippy library, which programs can use with 'import pippy'.
The pygame portion of the library uses 'best practices' to avoid eating
up CPU, and pauses & suspends after 20 seconds of inactivity.
Diffstat (limited to 'data/math')
-rw-r--r-- | data/math/guess | 3 | ||||
-rw-r--r-- | data/math/sierpinski | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/data/math/guess b/data/math/guess index 97ee098..d80514c 100644 --- a/data/math/guess +++ b/data/math/guess @@ -1,6 +1,5 @@ import random -from random import randrange -R = randrange(1,100) +R = random.randrange(1,100) print "Guess a number between 1 and 100!" N = input("Enter a number: ") diff --git a/data/math/sierpinski b/data/math/sierpinski index 133acc4..8b5f291 100644 --- a/data/math/sierpinski +++ b/data/math/sierpinski @@ -14,13 +14,13 @@ for i in range(0,lines): newvector = vector[:] for j in range(0,len(vector)-1): if (newvector[j] == 0): - sys.stdout.write(" ") + print " ", else: remainder = newvector[j] % modulus if (remainder == 0): - sys.stdout.write("O") + print "O", else: - sys.stdout.write(".") + print ".", newvector[j] = vector[j-1] + vector[j+1] print vector = newvector[:] |