Jan-12-2020, 07:34 PM
Yes indeed. The function will always return "2". Look sharp at your code:
I hope this helps you.
even2="2" ... clusterAssigments=even2 return clusterAssigmentsYou should write comment lines (starting with "#") in your code for explanation, because I cannot understand what you are trying to achieve. But I can see there are problems with the following part:
while ref==even1: clusterAssigments=even2 if ref==uneven1: clusterAssigments=uneven1 else:ref==even1 and ref==uneven3In the while you compare an integer (ref) with a bool (even1). I checked it by placing print statements before the while loop.
print("ref=" + str(ref)) print("even1=" + str(even1))
Output:ref=10
even1=True
So I can tell you: the loop will not execute. And if it would execute, how would it end? The line else:ref==even1 and ref==uneven3
is of course also not correct. You execute a boolean expression and do not assign it to anything.I hope this helps you.