Corrections for Question 3:

We keep on referring to $p[n]$ and $P[k]$ which was never defined. Just set $p[n]=x[n]$:

$\ \ \ \ \ p(t) = x(t) = \cos(900\cdot2\pi t)+0.15\cos(800\cdot2\pi t)$, and
$\ \ \ \ \ p[n] = x[n] = x(t)$ sampled at $F_s=2$kHz for 50 samples.

Expected output:

In [21]:
%matplotlib inline
%run memo.py

Audio outputs from Q1

In [22]:
IPython.lib.display.Audio(rate=rate, data=data)
Out[22]:
In [23]:
IPython.lib.display.Audio(rate=10000, data=noise)
Out[23]:
In [24]:
IPython.lib.display.Audio(rate=10000, data=y_keep)
Out[24]: