[ create a new paste ] login | about

d3m3vilurr

Name: d3m3vilurr
Email:
Site/Blog: http://d3m3vilurr.tistory.com
Location: earth
Default language: Python
Favorite languages: python
About:

Saved pastes by d3m3vilurr:

Python, pasted on Aug 4:
1
2
3
4
5
import unittest

class RepeatTest(unittest.TestCase):
  def testSimpleRepeat(self):
    self.assertEqual(3, getRepeatLength("3453453453"))
...
view (44 lines)
Python, pasted on May 16:
1
2
3
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)
Python, pasted on Feb 21:
1
2
3
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)
Python, pasted on Feb 21:
1
2
3
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)
Python, pasted on Feb 5:
1
2
3
n,k=input()
f=lambda s:s and s*f(s-1)or 1
print f(n)/f(k)/f(n-k)
view (3 lines)
Python, pasted on Feb 5:
1
2
3
n,k=input()
f=lambda s:s>0 and s*f(s-1)or 1
print f(n)/f(k)/f(n-k)
view (3 lines)
Python, pasted on Feb 4:
1
2
3
4
5
n,x=input(),1
s='%d: '%n
while x<n:
 x+=1;c=0
 while not n%x:n/=x;c+=1
...
view (7 lines)
Python, pasted on Feb 4:
1
2
3
4
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)
Python, pasted on Feb 4:
1
2
3
4
5
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)
Python, pasted on Feb 4:
1
2
3
4
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)
Python, pasted on Feb 4:
1
2
3
4
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)