Sep-26-2017, 09:11 PM
(Sep-18-2017, 11:38 AM)metulburr Wrote: maybe add a zip in a for loop example as questioned here
Quote:for i in correct:
#how could i compare here the two array without writing it in the C way?for item, check in zip(received, correct): if item == check: coincident += 1
Wouldn't it be better to avoid an intermediate variable or zipping, and instead just do set arithmetic?
coincident = len(set(received) & set(correct))Unless one or both of those are a generator/stream to something that might not all fit into memory, I suppose.