For which $n$ is $\mathbb{A}^n\setminus \{0\}$ an affine variety? For which $n$ is $\mathbb{A}^n(k)\setminus \{0\}$ an affine variety? I think for $n=0$ and $n=1$ it is. 


*

*For $n=0$, take the ideal $\mathfrak{a}:=(1)$ in $k[T]$. Then $V(\mathfrak{a})=\emptyset$ should be isomorphic to $\mathbb{A}^n(k)\setminus \{0\}$.

*For $n=1$, take the ideal $\mathfrak{a}:=(T_1T_2-1)$ in $k[T_1,T_2]$. Then $V(\mathfrak{a})$ should be isomorphic to $\mathbb{A}^n(k)\setminus \{0\}$. The isomorphism is given by $f:V(\mathfrak{a})\to \mathbb{A}^n(k)\setminus \{0\}$, $(x,y)\mapsto x$.

*For $n>1$ probably not, but I don't have a proof.
So my questions are:


*

*Is it correct what I did for the cases $n\in\{0,1\}$?

*How do I prove that $f$ in case $n=1$ is an isomorphism of spaces of functions?

*What about the case for $n>1$?
Edit: As already noted in my comment: $\mathbb{A}^0(k)\setminus \{0\}$ is not affine because the empty set is not irreducible.
 A: For $n\geq 2$, $H^1(\mathbb{A}^n\backslash \{0\}, \mathcal{O})$ is infinite dimensional (so this must vanish ). By Serre's criterion for affineness, this is not affine.  
A: For $n=0$ you get the empty set.
For $n=1$, we have that $\mathbb{A}^1-0$ is isomorphic to the affine variety $V(xy-1)\subset\mathbb{A}^2$ via the map:
$$\begin{array}{lrcl}\phi:&\mathbb{A}^1-0&\longrightarrow&V(xy-1)\\&z&\longmapsto&\left(z,\frac{1}{z}\right)\end{array}$$
Finally, for any $n>1$ we have that $\mathbb{A}^n-0$ is not affine. Indeed in this case we have that the ring of regular functions $\Gamma(\mathbb{A}^n-0)\cong\mathbb{C}[x_1,\ldots,x_n]$, and thus if it were affine it should be isomorphic to $\mathbb{A}^n$. However this is not possible.
A: I would like to add a different way of phrasing Daniel Robert-Nicoud's argument.
Suppose that $\mathbb{A}^n-\{0\}$ were affine. Consider the inclusion $\mathbb{A}^n-\{0\}\hookrightarrow\mathbb{A}^n$. The induced map on global sections is just the restriction map $\mathcal{O}_{\mathbb{A}^n}(\mathbb{A}^n)\to\mathcal{O}_{\mathbb{A}^n}(\mathbb{A}^n-\{0\})$--this is obviously injective. But it is surjective, since the image, when both are thought of as embedded in $K(\mathbb{A}^n)$, is just the copy of $k[x_1,\ldots,x_n]$ sitting inside the elements of $K(\mathbb{A}^n)$ of the form 
$$\displaystyle \bigcap_{\mathfrak{p}\in\mathbb{A}^n-\{0\}}k[x_1,\ldots,x_n]_\mathfrak{p}$$
But, this in particular, is an intersection over all codimension $1$ primes, and since $k[x_1,\ldots,x_n]$ is Noetherian and normal, this is just $k[x_1,\ldots,x_n]$ (this is sometime's called 'Algebraic Hartog's Lemma'). Thus, the restriction map is also surjective.
So, the induced map $\mathcal{O}_{\mathbb{A}^n}(\mathbb{A}^n)\to\mathcal{O}_{\mathbb{A}^n}(\mathbb{A}^n-\{0\})$ is an isomorphism, which if $\mathbb{A}^n-\{0\}$ were affine would imply (since both are affine and the anti-equivalence of categories between affine schemes and rings) that the original map, the inclusion $\mathbb{A}^n-\{0\}\hookrightarrow\mathbb{A}^n$ is an isomorphism--but this is nonesense.
Honestly, even though that looks really technical, that is the only proof (that I know of) that is simultaneously clean, and rigorous. It's kind of an annoying problem to do 'precisely' when you don't have a lot of machinery. The quickest proofs, as other answerers have said, is cohomological.
