'P value and critical value in hypothesis testing

I need little clarification in p value and critical value approach in hypothesis testing regarding below example.

Null Hypothesis : population mean = 80

Alternative : population mean != 80

sample_mean = 78

sample_std = 2.5 n = 40

after calculating Z statistic that gives value of -5.063, which falls in rejection region (with 95% confidence level) thus rejects null. But if I calculate p_value from test statistic using scipy.stats.norm.sf(abs(-5.063)) in python it accepts null. So whats happening here. I need guidelines.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source