|
d3m3vilurr
|
|
codepad
|
|
|
d3m3vilurr
|
Saved pastes by d3m3vilurr:
import unittest
class RepeatTest(unittest.TestCase):
def testSimpleRepeat(self):
self.assertEqual(3, getRepeatLength("3453453453"))
|
| view (44 lines) |
s=p=0
for x in raw_input():z='IVXLCDM'.find(x);x=10**(z/2)*(1,5)[z%2];s+=(x,x-p-p)[p<x];p=x
print s
|
| view (3 lines) |
s=p=0
for x in raw_input():x=dict(zip('IVXLCDM',(1,5,10,50,100,500,1000)))[x];s+=(x,x-p-p)[p<x];p=x
print s
|
| view (3 lines) |
s=p=0
for x in raw_input():x={6:1,19:5,21:10,9:50,0:100,1:500,10:1000}[ord(x)-67];s+=(x,x-p-p)[p<x];p=x
print s
|
| view (3 lines) |
n=99
while n:
for c in 1,0:N=(([99]+range(1,n))[-1],n)[c];x=('%d bottles'%N)[:7+N]+' of beer on the wall';print(('Go to the store and buy some more, ','Take one down and pass it around, ')[n>1]+x+('.','.\n')[n>1],x+', '+x[:-12]+'.')[c]
n-=1
|
| view (4 lines, 296 lines of output) |
n=99
B=", %d %s of beer.\n"
x=lambda n:(n,'bottles'[:5+n])
l=[n]*2+range(1,n+1)
o=B[2:-2]+" on the wall"
|
| view (7 lines, 296 lines of output) |
n,B,x=99,", %d %s of beer.\n",lambda n:(n,'bottles'[:5+n]);l=[n]*2+range(1,n+1)
o=B[2:-2]+" on the wall"
s="Go to the store and buy some more, %s."%o,"Take one down and pass it around, %s.\n"%o,o+B
while n:print(s[2]+s[n>1:][0])%(x(n)*2+x(l[n]));n-=1
|
| view (4 lines, 296 lines of output) |
n,B,x=99,", %d %s of beer.\n",lambda n:(n,'bottles'[:5+n]);l=range(100);l[0]=99
o=B[2:-2]+" on the wall"
s="Go to the store and buy some more, %s."%o,"Take one down and pass it around, %s.\n"%o,o+B
while n:print(s[2]+s[(n>1):][0])%(x(n)*2+x(l[n-1]));n-=1
|
| view (4 lines, 296 lines of output) |