Advertisement
Guest User

Untitled

a guest
Aug 19th, 2014
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. sub_id = [14309080,   14309081,   14309082,   14309083,   14309084,   14309085,   14309086,   14309087,   14309088,   14309089,   14309090,   14309091,   14309092,   14309093,   14309094]   #,   14309095]
  2. cdn_id = [1408467242, 1408467242, 1408467246, 1408467254, 1408467268, 1408467282, 1408467286, 1408467291, 1408467292, 1408467302, 1408467304, 1408467319, 1408467327, 1408467332, 1408467343] #, 0]
  3.  
  4. #sub_id = [1388580,    1388579]
  5. #cdn_id = [1213770987, 1213771002]
  6.  
  7. def distance(l):
  8.   rv = []
  9.   for n in range(len(l)):
  10.     if n==0:
  11.       rv.append(0)
  12.     else:
  13.       rv.append(l[n] - l[n-1])
  14.   return rv
  15.      
  16.  
  17. if __name__ == '__main__':
  18.  
  19.   print("sub_id:  ", sub_id) #Submission number
  20.   print("cdn_id:  ", cdn_id) #Download number
  21.   print("distance:", distance(cdn_id)) #Distance between consecutive download links (first is always zero)
  22.  
  23.  
  24.   dif = lambda x,y: x-y
  25.   sub_cdn_dif = list(map(dif, cdn_id, sub_id))
  26.   cdn_dif = list(map(dif, cdn_id[-1:]*len(cdn_id), cdn_id))
  27.   print("cdn_dif: ", cdn_dif) #Cummulative difference between download links, first is zero
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement