[ create a new paste ] login | about

Link: http://codepad.org/h9CWCBNO    [ raw code | output | fork ]

Python, pasted on May 27:
1
2
3
4
5
6
7
8
9
10
11
12
13
inputString = "219.45.143.143"

p=r=0
for i in inputString:
 c=3,0
 if i!=".":
  c=divmod(int(i)-1,3)
  if i<1:
   c=3,1
 if p:                   
  r+=((p[1]-c[1])**2+(p[0]-c[0])**2)**0.5
 p=c
print"%.2fcm"%r


Output:
1
27.38cm


Create a new paste based on this one


Comments: