text processing utilities

Highlight Dokumentation

Theme-Beispiele (Auswahl)

Andes

01 #!/usr/bin/env python
02 
03 fibs = {0: 0, 1: 1}
04 def fib(n):
05     if n in fibs: return fibs[n]
06     if n % 2 == 0:
07         fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
08         return fibs[n]
09     else:
10         fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
11         return fibs[n]
12 
13 print ("fib(234) = %i" % fib(234))

Breeze

01 #!/usr/bin/env python
02 
03 fibs = {0: 0, 1: 1}
04 def fib(n):
05     if n in fibs: return fibs[n]
06     if n % 2 == 0:
07         fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
08         return fibs[n]
09     else:
10         fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
11         return fibs[n]
12 
13 print ("fib(234) = %i" % fib(234))

Candy

01 #!/usr/bin/env python
02 
03 fibs = {0: 0, 1: 1}
04 def fib(n):
05     if n in fibs: return fibs[n]
06     if n % 2 == 0:
07         fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
08         return fibs[n]
09     else:
10         fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
11         return fibs[n]
12 
13 print ("fib(234) = %i" % fib(234))

Fine-Blue

01 #!/usr/bin/env python
02 
03 fibs = {0: 0, 1: 1}
04 def fib(n):
05     if n in fibs: return fibs[n]
06     if n % 2 == 0:
07         fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
08         return fibs[n]
09     else:
10         fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
11         return fibs[n]
12 
13 print ("fib(234) = %i" % fib(234))

Matrix

01 #!/usr/bin/env python
02 
03 fibs = {0: 0, 1: 1}
04 def fib(n):
05     if n in fibs: return fibs[n]
06     if n % 2 == 0:
07         fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
08         return fibs[n]
09     else:
10         fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
11         return fibs[n]
12 
13 print ("fib(234) = %i" % fib(234))

Moria

01 #!/usr/bin/env python
02 
03 fibs = {0: 0, 1: 1}
04 def fib(n):
05     if n in fibs: return fibs[n]
06     if n % 2 == 0:
07         fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
08         return fibs[n]
09     else:
10         fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
11         return fibs[n]
12 
13 print ("fib(234) = %i" % fib(234))

Seashell

01 #!/usr/bin/env python
02 
03 fibs = {0: 0, 1: 1}
04 def fib(n):
05     if n in fibs: return fibs[n]
06     if n % 2 == 0:
07         fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
08         return fibs[n]
09     else:
10         fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
11         return fibs[n]
12 
13 print ("fib(234) = %i" % fib(234))

Vampire

01 #!/usr/bin/env python
02 
03 fibs = {0: 0, 1: 1}
04 def fib(n):
05     if n in fibs: return fibs[n]
06     if n % 2 == 0:
07         fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
08         return fibs[n]
09     else:
10         fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
11         return fibs[n]
12 
13 print ("fib(234) = %i" % fib(234))

Zellner

01 #!/usr/bin/env python
02 
03 fibs = {0: 0, 1: 1}
04 def fib(n):
05     if n in fibs: return fibs[n]
06     if n % 2 == 0:
07         fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
08         return fibs[n]
09     else:
10         fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
11         return fibs[n]
12 
13 print ("fib(234) = %i" % fib(234))

Zenburn

01 #!/usr/bin/env python
02 
03 fibs = {0: 0, 1: 1}
04 def fib(n):
05     if n in fibs: return fibs[n]
06     if n % 2 == 0:
07         fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
08         return fibs[n]
09     else:
10         fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
11         return fibs[n]
12 
13 print ("fib(234) = %i" % fib(234))
Tupel7