I’m trying to remove duplicates (same problem as yesterday) but I’m now trying using appending method if the item is not in the empty list but I’m getting this error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
def listdupremover(solution): leng=len(solution) results=[] sol=list(solution) for i in range(0,leng-1): if solution[i] not in results: results.append(solution[i]) return results
the 2d array “solution is 625 long made of 9 possible sub-arrays of +/- 0.25, +/-3.99 and [0,0], and unfortunately the position matters as its coordinates and there needs to be the 8 (plus the 0,0 which will be resolved when I use the information here and use it in the previous code)
submitted by /u/Hung003
[link] [comments]
r/learnpython I’m trying to remove duplicates (same problem as yesterday) but I’m now trying using appending method if the item is not in the empty list but I’m getting this error: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() def listdupremover(solution): leng=len(solution) results=[] sol=list(solution) for i in range(0,leng-1): if solution[i] not in results: results.append(solution[i]) return results the 2d array “solution is 625 long made of 9 possible sub-arrays of +/- 0.25, +/-3.99 and [0,0], and unfortunately the position matters as its coordinates and there needs to be the 8 (plus the 0,0 which will be resolved when I use the information here and use it in the previous code) submitted by /u/Hung003 [link] [comments]
I’m trying to remove duplicates (same problem as yesterday) but I’m now trying using appending method if the item is not in the empty list but I’m getting this error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
def listdupremover(solution): leng=len(solution) results=[] sol=list(solution) for i in range(0,leng-1): if solution[i] not in results: results.append(solution[i]) return results
the 2d array “solution is 625 long made of 9 possible sub-arrays of +/- 0.25, +/-3.99 and [0,0], and unfortunately the position matters as its coordinates and there needs to be the 8 (plus the 0,0 which will be resolved when I use the information here and use it in the previous code)
submitted by /u/Hung003
[link] [comments]