I have this code i'm translating from js to python and i have this:
if( this.risultato.every((v, i) => v === this.atteso[i]) ){}
whats the equivalent in python for the every(); function and if it's not builtin how do i create a similar function? For the arrow function part i came onto this solution:
lambda v, i: v == self.atteso[i]
the equivalent in python is all function:
mylist = [True, True, True]
x = all(mylist)
Or:
def all(iterable):
for element in iterable:
if not element:
return False
return True
if all(self.risultato[i] == self.atteso[i] for i in len(self.risultato)):
seems like a direct translation. Or,
if all( i==j for (i,j) in zip(self.risultato, self.atteso)):