An A/B test compares two variants, randomly assigned to groups, to find out which converts better. The primary metric and the sample size are fixed before launch. A two-proportion test gives a p-value, compared with a threshold set in advance (often 5%). Stopping as soon as the p-value drops below the threshold (peeking) increases false positives.
Example
from statsmodels.stats.proportion import proportions_ztest
z, p = proportions_ztest([120, 150], [2000, 2000])