Please be informed that your method def findNumber(arr, k): does not yield anything, so it is returning None implicitly.
result = findNumber(arr, k)
fptr.write(result + '\n')
Don't add None and a string together as it won't work in this case. Rather than printing inside your function, return "Yes" or "No".
Want to be a Python expert? Join this Python Training course by Intellipaat to learn more.