diff options
author | Darío Clavijo <daedalus2027@gmail.com> | 2010-10-29 23:36:38 (GMT) |
---|---|---|
committer | Darío Clavijo <daedalus2027@gmail.com> | 2010-10-29 23:36:38 (GMT) |
commit | 93513e0cce391ec441e864b8b7e0e61750726317 (patch) | |
tree | f26bf36001d532bada88779c8b05a5af8a16c093 | |
parent | 9e556d4a930ff4f56b1503ba342cf288d510d95d (diff) |
xep-08 compliant
-rw-r--r-- | data/math/factorial | 2 | ||||
-rw-r--r-- | data/misc/lifegame | 43 | ||||
-rw-r--r-- | data/string/jeringoso | 23 |
3 files changed, 40 insertions, 28 deletions
diff --git a/data/math/factorial b/data/math/factorial index cdbd753..5c796ac 100644 --- a/data/math/factorial +++ b/data/math/factorial @@ -31,7 +31,7 @@ def calculate(number,type): print "Type: " , type_s , " in: ", 1/delta #we ask for a number to factorice -number = input("Please imput a number:") +number = input("Please input a number:") print "Calculating..." calculate(number,0) calculate(number,1) diff --git a/data/misc/lifegame b/data/misc/lifegame index 89c47d6..2631048 100644 --- a/data/misc/lifegame +++ b/data/misc/lifegame @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# Bibliotecas +# This is the game life http://en.wikipedia.org/wiki/The_Game_of_Life + import os, time, random # @@ -7,34 +8,34 @@ import os, time, random # def LoadCells(rows,cols): - grid=[] - col = [0]*cols - cells=0 + grid=[] + col = [0]*cols + cells=0 #first we load an empty grid - for i in range(rows): - col = [0]* cols - grid.append(col) + for i in range(rows): + col = [0]* cols + grid.append(col) #then we load some cells - for x in range(rows): - for y in range(cols): - cell = random.randint(0,random.randint(0,1)) - grid[x][y] = cell - return grid + for x in range(rows): + for y in range(cols): + cell = random.randint(0,random.randint(0,1)) + grid[x][y] = cell + return grid # # here we draw the grid # def DrawGrid(grid): - rows=len(grid) - cols=len(grid[1]) - for x in range(rows): - for y in range(cols): - if grid[x][y]==0: - print ".", - else: - print "o", - print "\n", + rows=len(grid) + cols=len(grid[1]) + for x in range(rows): + for y in range(cols): + if grid[x][y]==0: + print ".", + else: + print "o", + print "\n", # # this funcion count neighbors arround a single cell diff --git a/data/string/jeringoso b/data/string/jeringoso index e6ad0d5..c041a2f 100644 --- a/data/string/jeringoso +++ b/data/string/jeringoso @@ -1,10 +1,21 @@ -text = raw_input("Please imput your text to translate to jeringoso:") +# jeringoso is an inocent spanish way to talk used by kids, +# you need to add an "p" before earch spanish vowel (a,e,i,o,u) and +# the same vowel after the "p" +# then you got a funny way to talk that parents will not understand. +# ref: http://en.wikipedia.org/wiki/Jeringonza + +#first we define the spanish vowels +vowels = ['a','e','i','o','u'] + +#then we ask for a string to make the replacements +text = raw_input("Please input your text to translate to jeringoso:") length = len(text) jeringoso="" for i in range(length): - char = text[i] - if char == "a" or char == "e" or char == "i" or char == "o" or char == "u": - jeringoso = jeringoso + char + "p" + char - else: - jeringoso = jeringoso + char + char = text[i] + if char in vowels: + jeringoso = jeringoso + char + "p" + char + else: + jeringoso = jeringoso + char + print jeringoso |