I am having a difficult time figuring out where my code is failing. Hackerrank has its own boilerplate testing that I am not accustomed to yet. The algorithm workers in the Hackerrank debug output and in my own Ide but returns "NoneNone" in Stdout. I know that returning nothing creates None but even when I do "return '/n'.join(a_list) it doesn't work. Making me unable to pass tests. What am I not seeing? https://www.hackerrank.com/challenges/cut-the-sticks/problem
This is NOT a duplicate problem. The down votes are very discouraging and unhelpful nvm.
#!/bin/python3
import math
import os
import random
import re
import sys
def cutTheSticks(arr):
currentSize = len(arr)
while currentSize > 0:
least = min(arr)
print(currentSize)
for stick in range(len(arr)):
arr[stick] -= least
if arr[stick] <= 0:
arr[stick] = 0
for i in range(arr.count(0)):
arr.remove(0)
currentSize = len(arr)
return
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input())
arr = list(map(int, input().rstrip().split()))
result = str(cutTheSticks(arr))
fptr.write(result)
fptr.write('\n'.join(map(str, result)))
fptr.write('\n')
fptr.close()