Recent public codes are listed below. You can filter them by the following programming languages:
- view
- All
- Ada
- Assembler
- Assembler
- AWK (gawk)
- AWK (mawk)
- Bash
- bc
- Brainf**k
- C
- C#
- C++
- C++0x
- C99 strict
- CLIPS
- Clojure
- COBOL
- COBOL 85
- Common Lisp (clisp)
- D (dmd)
- Erlang
- F#
- Factor
- Falcon
- Forth
- Fortran
- Go
- Groovy
- Haskell
- Icon
- Intercal
- Java
- JavaScript (rhino)
- JavaScript (spidermonkey)
- Lua
- Nemerle
- Nice
- Nimrod
- Objective-C
- Ocaml
- Oz
- Pascal (fpc)
- Pascal (gpc)
- Perl
- Perl 6
- PHP
- Pike
- Prolog (gnu)
- Prolog (swi)
- Python
- Python 3
- R
- Ruby
- Scala
- Scheme (guile)
- Smalltalk
- SQL
- Tcl
- Text
- Unlambda
- VB.NET
- Whitespace
-
1 2 3 4 5 6 7 8 9
def appendix(num): if num % 100 in [11, 12, 13]: return str(num) + 'th' else: if num % 10 == 1: return str(num) + 'st' elif num % 10 == 2: return str(num) + 'nd' elif num % 10 == 3: return str(num) + 'rd' else: return str(num) + 'th' numlist = [appendix(i) for i in xrange(1000)]
-
1 2 3 4 5 6 7 8
def appendix(num): if num % 100 in [11, 12, 13]: return str(num) + 'th' else: num %= 10 if num == 1: return str(num) + 'st' elif num == 2: return str(num) + 'nd' elif num == 3: return str(num) + 'rd' else: return str(num) + 'th'
...
-
1
print 3
-
1 2 3 4 5 6 7 8 9
from math import sqrt n = 99 n = float(n) sqaureRootOfN = sqrt(n) print '-'*75 print ' # of Decimals', ' ' * 8, 'New Root', ' ' * 10, 'Percent error' print '-'*75 for a in range(0,10):
...
-
1 2 3 4 5 6
def appendix(num): if num[-2:] in ['11', '12', '13'] or num[-1] not in ['1', '2', '3']: return num + 'th' else: return {'1':num+'st', '2':num+'nd', '3':num+'rd'}[num[-1]] numlist = [appendix(str(i)) for i in xrange(1000)] for number in numlist: print number
-
1 2 3 4 5 6 7 8 9
def appendix(num): if num[-2:] in ['11', '12', '13']: return num + 'th' elif num[-1] == '1': return num + 'st' elif num[-1] == '2': return num + 'nd' elif num[-1] == '3': return num + 'rd' else: return num + 'th' numlist = [appendix(str(i)) for i in xrange(1000)] for number in numlist: print number
-
1 2 3 4
import sys.argv def teste(): print("Hello")
-
1 2 3 4 5 6 7 8 9
def appendix(num): if num[-2:] in ['11', '12', '13']: return num + 'th' elif num[-1] == '1': return num + 'st' elif num[-1] == '2': return num + 'nd' elif num[-1] == '3': return num + 'rd' else: return num + 'th' a = [appendix(str(i)) for i in xrange(1000)] for number in a: print number, number[-2:]
-
1 2 3 4 5 6 7 8 9
def appendix(num): if num[:-2] in ['11', '12', '13']: return num + 'th' elif num[-1] == '1': return num + 'st' elif num[-1] == '2': return num + 'nd' elif num[-1] == '3': return num + 'rd' else: return num + 'th' a = [appendix(str(i)) for i in xrange(1000)] for number in a: print number, number[:-2]
-
1 2 3 4 5 6 7 8 9
def appendix(num): if num[:-2] in ['11', '12', '13']: return num + 'th' elif num[-1] == '1': return num + 'st' elif num[-1] == '2': return num + 'nd' elif num[-1] == '3': return num + 'rd' else: return num + 'th' a = [appendix(str(i)) for i in xrange(1000)] for number in a: print number
-
1 2 3 4 5 6 7 8 9
def appendix(num): if num[:-2] in ['11', '12', '13']: return num + 'th' elif num == '1': return num + 'st' elif num == '2': return num + 'nd' elif num == '3': return num + 'rd' else: return num + 'th' a = [appendix(str(i)) for i in xrange(1000)] for number in a: print number
-
1 2 3 4 5 6 7 8
def appendix(num): if num[:-2] in ['11', '12', '13']: return num + 'th' elif num == '1': return num + 'st' elif num == '2': return num + 'nd' elif num == '3': return num + 'rd' else: return num + 'th' print [appendix(str(i)) for i in xrange(100)]
-
1 2 3 4 5 6 7 8
def appendix(num): if num in [11, 12, 13]: return str(num) + 'th' elif num % 10 == 1: return str(num) + 'st' elif num % 10 == 2: return str(num) + 'nd' elif num % 10 == 3: return str(num) + 'rd' else: return str(num) + 'th' print [appendix(i) for i in xrange(100)]
-
1 2 3 4 5 6 7
def appendix(num): if num % 10 == 1: return str(num) + 'st' elif num % 10 == 2: return str(num) + 'nd' elif num % 10 == 3: return str(num) + 'rd' else: return str(num) + 'th' print [appendix(i) for i in xrange(100)]
-
1 2
name = "snow storm" print "%s" %name[6:8]
-
1 2 3 4
import re m = re.match(r'^:(.+?)!(.+?)@(.+)$', ':apples!apples@apples.com') print m.group(1)
-
1 2 3 4 5 6 7 8 9
def median(pool): '''Statistical median to demonstrate doctest. >>> median([2, 9, 9, 7, 9, 2, 4, 5, 8]) 7 ''' copy = sorted(pool) size = len(copy) if size % 2 == 1: return copy[(size - 1) / 2]
...
-
1 2 3 4 5 6 7
def appendix(num): if num[-1] == '1': return 'st' elif num[-1] == '2': return 'nd' elif num[-1] == '3': return 'rd' else: return 'th' print [str(i) + appendix(str(i)) for i in xrange(100)]
-
1
print 'hello'
-
1 2 3 4 5 6 7 8 9
import unittest def median(pool): copy = sorted(pool) size = len(copy) if size % 2 == 1: return copy[(size - 1) / 2] else: return (copy[size/2 - 1] + copy[size/2]) / 2 class TestMedian(unittest.TestCase):
...
-
1
print 'hello
-
1 2 3 4 5 6 7 8 9
class BankAccount(object): def __init__(self, initial_balance=0): self.balance = initial_balance def deposit(self, amount): self.balance += amount def withdraw(self, amount): self.balance -= amount def overdrawn(self): return self.balance < 0
...
-
1 2 3 4 5 6 7 8 9
REFRAIN = ''' %d bottles of beer on the wall, %d bottles of beer, take one down, pass it around, %d bottles of beer on the wall! ''' bottles_of_beer = 99 while bottles_of_beer > 1: print REFRAIN % (bottles_of_beer, bottles_of_beer,
...
-
1 2 3 4 5 6 7 8
from time import localtime activities = {8: 'Sleeping', 9: 'Commuting', 17: 'Working', 18: 'Commuting', 20: 'Eating', 22: 'Resting' }
...
-
1 2 3 4 5 6 7 8 9
# indent your Python code to put into an email import glob # glob supports Unix style pathname extensions python_files = glob.glob('*.py') for file_name in sorted(python_files): print ' ------' + file_name with open(file_name) as f: for line in f:
...
-
1 2 3 4
import re m = re.match(r'^:(.*?)!(.*?)@(.*)$', ':apples!apples@apples.com') print m.groups()
-
1 2 3 4
import re m = re.match(r'^:(.*?)!.*?@.*$', ':apples!apples@apples.com') print m.groups()
-
1 2 3 4
import re m = re.match(r'^:([^!]+)!([^@]+)@(.*)$', ':apples!apples@apples.com') print m.groups()
-
1 2 3 4 5 6 7 8 9
import time reptime = int(raw_input("How many seconds per rep? ")) inc = int(raw_input("How many seconds per increment? ")) sets = int(raw_input("How many sets? ")) rest = int(raw_input("How many seconds rest between sets? ")) while sets >0: time.sleep(rest)
...
-
1 2 3
a = '\t<56,000' b = int(a.translate(None, "\t<,")) print b


