I’m returning count here, which before the return statement gives <type 'int'>
but after it gets returned the output I get is None
.
def equal(arr,count):
arr = sorted(arr)
if arr[0]==arr[-1]:
print(count) # the answer I’m getting is correct so I don’t
#think there’s a problem with rest of the code
return count
if (arr[-1]-arr[0])>=5:
diff=5
elif(arr[-1]-arr[0])>=2:
diff=2
else:
diff=1
for i in range(len(arr)-1):
arr[i]+=diff
count+=1
equal(arr,count)
a=[10,7,12]
print(equal(a,0)) # I'm getting output here as **None**enter code here