Guest User

Untitled

a guest
Dec 16th, 2019
85
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def getArray(fromMin, toMax, center):
  2.     mixedArray = []
  3.     centerMax = []
  4.     centerMin = []
  5.     maxArrayCount = 0
  6.  
  7.     for x in range(center, toMax):
  8.         centerMax.append(x)
  9.     for y in range(center, fromMin, -1):
  10.         centerMin.append(y)
  11.  
  12.     # for x, y in zip(centerMax, centerMin):
  13.     #     mixedArray.append(x)
  14.     #     mixedArray.append(y)
  15.  
  16.     if len(centerMax) > len(centerMin):
  17.         maxArrayCount = len(centerMax)
  18.     else:
  19.         maxArrayCount = len(centerMin)
  20.  
  21.     for i, x in enumerate(range(0, len(centerMax))):
  22.         try:
  23.             mixedArray.append(centerMax[i])
  24.             mixedArray.append(centerMin[i])
  25.         except IndexError:
  26.             pass
  27.         continue
  28.        
  29.     return list(dict.fromkeys(mixedArray))
  30.  
  31.  
  32. print(getArray(25, 50, 35))
RAW Paste Data