You flip a coin $10$ times and observe only one head. Determine the $p$-value for testing whether the coin is fair or not? 
You flip a coin $10$ times and observe only one head. Determine the
$p$-value for testing whether the coin is fair or not?

I don't want to use CLT because $n$ is not large enough.
Let $X_i \sim \text{Bern}(p)$ where $p$ is probability of getting head.
Null: $p = \frac12$
Alternate: $p \neq \frac12$
Now, let $X=\sum X_i \sim \text{Bin}(10, p)$ be our test-statistic.
Then, under Null, $X \sim \text{Bin}(10, \frac12)$.
Let $t$ denote observed value of our test-statistic, we have $x=9$ since the test-statistic represents the number of heads obtained.
$p$-value is defined as the probability, under Null hypothesis, of observing test-statistic which is more extreme than it's observed value in favor of alternate hypothesis.
more extreme excludes the observed value, so, the $p$-value is :
$$P(|\text{Bin}(10, \frac12)| > |9| ) 
\\= P(|\text{Bin}(10, \frac12)| > 9 ) \\
= P\big(\text{Bin}(10, \frac12) > 9 \big) + P\big(\text{Bin}(10, \frac12) < -9 \big) 
\\ = P\big(\text{Bin}(10, \frac12) > 9 \big) \\ =0.00098$$
Is my solution correct?
Edit: Add class notes


You have the right idea, but the wrong definition.  The $p$-value is the conditional probability of observing an outcome at least as extreme as the one that was obtained, given that the null hypothesis is true.
Therefore, the $p$-value of this test is $$\Pr[X \in \{0, 1, 9, 10\} \mid H_0],$$ where $X \mid H_0 \sim \operatorname{Binomial}(n = 10, p = 1/2)$.
The reason why the $p$-value includes the observed outcome is because you are trying to argue that if the $p$-value is "too small," then the assumption that $H_0$ is true is implausible; i.e., the experimental data we observed--which includes the actual outcome--is too unlikely to have been observed if the null were true.
Note that the choice of which outcomes of $X$ are included in a one-sided exact binomial test is rather straightforward, but not in a two-sided test if $p_0$, the probability of heads under the null hypothesis, is not $1/2$.  For instance, if we were interested in testing the two-sided hypothesis
$$H_0 : p = p_0 = 2/3, \quad \text{vs.} \quad H_1 : p \ne 2/3,$$
then the observed outcome $X = 9$ under the null has probability $$\Pr[X = 9 \mid H_0] = \binom{10}{9} (2/3)^9 (1 - 2/3)^1 = \frac{5120}{59049} \approx 0.0867076.$$  Then the set of outcomes that is included in the $p$-value calculation includes those whose probabilities are at most equal to this value.  On the right-side tail, this obviously includes $\Pr[X = 10 \mid H_0]$, but the left-side tail is not so clear because the distribution is no longer symmetric.  We calculate
$$\begin{array}{c|c}
x & \Pr[X = x \mid H_0]\\
\hline
0 & \frac{1}{59049} \approx 0.0000169351\\
1 & \frac{20}{59049} \approx 0.000338702 \\
2 & \frac{20}{6561} \approx 0.00304832\\
3 & \frac{320}{19683} \approx 0.0162577\\
4 & \frac{1120}{19683} \approx 0.0569019\\
5 & \frac{896}{6561} \approx 0.136565\\
\end{array}$$
where we stop at $X = 5$ because this is the first probability that exceeds $\Pr[X = 9 \mid H_0]$.  Then the $p$-value for the two-sided test is $$\Pr[X \in \{0, 1, 2, 3, 4, 9, 10\} \mid H_0],$$ for the null $H_0 : p = p_0 = 2/3$.
