SHARE
TWEET

Untitled

a guest Oct 15th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def main():
  2.     N = int(input("Enter the number of stairs"))
  3.     print('n is:', N)
  4.     array = getArrayLength(N)
  5.     arrLength = len(array)
  6.     getCombinations(array,arrLength)
  7. def getArrayLength(n):
  8.     array = []
  9.     arrayLength = int(n/2)
  10.     for x in range(arrayLength):
  11.         array.append(0)
  12.     return array
  13.  
  14. def getCombinations(array,arrLength,ifRemainder):
  15.     remainder = arrLength % 2
  16.     ifRemainder = arrLength-1
  17.     if remainder == 0:
  18.         for x in range(arrLength):
  19.             array[x] = 2
  20.     elif remainder == 1:
  21.          array.append(0)
  22.          for x in range(ifRemainder):
  23.              lastCounter = x
  24.              print("LastCounter: ",lastCounter)
  25.              array[x] = 2
  26.              if lastCounter == ifRemainder-1:
  27.                 lastSpot = x + 1
  28.                 array[lastSpot] = 1
  29.     print(array)
  30.     for x in range(arrLength):
  31.         if array[x] == 2:
  32.             array[x] = 1
  33.             array.append(1)
  34.             print(array)
  35.             arrLength = len(array)
  36.    
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top