1.Your function returns p = 0.0062 for 200/2,000 against 250/2,000, and the practice test expects 0.0124. Two identical groups give p = 0.5. What's wrong?
2.At alpha = 0.05 your interval for the worked example is (0.0086, 0.0414). The reference gives (0.0054, 0.0446). How often does yours cover the true difference?
3.Why does the z statistic use the pooled rate while the interval uses each group's own rate?
4.Your z uses the unpooled standard error, so it's 2.5039 on the worked example instead of 2.5020. When does that bug actually hurt?
5.A PM checks a 14-day test every day and stops it the first time p < 0.05. If the treatment does nothing, about how often does the test end on a significant result?