Wrong result when solving: "chance that two random cards differ in color and value?"
There's an error in your code:
cards = np.array([c+str(n) for c in (&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;, &quot;E&quot;) for n in range(1, 11)])

will produce &quot;A10&quot; and &quot;A1&quot; among other values, and
if a[0] != b[0] and a[1] != b[1]:

will return true when a=A10 and b=A1, for example. This is why you're probably consistently underestimating the number of differences.
An easy fix would be to use:
cards = np.array([c+str(n) for c in (&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;, &quot;E&quot;) for n in range(0, 10)])

instead, which is more readable anyway.  But if I were doing this, I might use itertools.product.
Even after this fix it's normal to not always get exactly the theoretical value, but it's bad if there's a bias (i.e. consistent under- or over- estimation).