Close Enough
Return True if every pair a[i], b[i] differs by at most tol (that is, |a[i] - b[i]| <= tol for all i), otherwise False. Both arrays have the same length.
Example 1
a [1,2,3]
b [1,3,3]
tol 1
returns true
The biggest difference is 1, which is allowed.
Constraints
1 <= len(a) = len(b) <= 100tol >= 0
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Closest to OriginEasy
- Closest to TargetEasy
- Column MaximumsEasy
- Column WinnersEasy
- Compound GrowthEasy
- Count BetweenEasy
- Count IncreasesEasy
- Count Sign ChangesEasy