Let $f\colon X\rightarrow Y$ be an affine map of schemes (i.e. there is an affine open cover $(U_i)_{i\in I}$ of $Y$ such that $f^{-1}(U_i)$ is affine for all $i$). Now given some affine open subscheme $V$ of $Y$ I need to show, that $f^{-1}(V)$ is also affine.
So every solution I have found online either uses quasi-coherent sheaves or fiber products. But we did not learn these yet. My Problem is that i don't even know where to begin so I would like to receive some hints.
I know that we obtain a cover of $f^{-1}(V)$: $f^{-1}(V)=\bigcup_{i\in I} f^{-1}(V)\cap f^{-1}(U_i)$ and we can pick Rings $A_i$ with $f^{-1}(U_i)=spec(A_i)$. And now I don't know how to continue.
There is a trick to solve these kinds of problem. It is called the affine communication lemma by Vakil in his note Foundations of Algebraic Geometry. For convenience, I recall statements here
Affine Communication Lemma. Let $X$ be a scheme and $U,V$ two affine open subschemes, then $U \cap V$ can be written as a union of affine open subschemes that are simultaneously principal in both $U,V$.
Setting $P$ to be being affine in $X$ in the following corollary of the above gives what you want.
Corollary. Let $P$ be some property of affine open subschemes of $X$, such that:
Suppose that $X = \bigcup_i \operatorname{Spec}(A_i)$ with each $\operatorname{Spec}(A_i)$ having $P$, then any affine open subscheme of $X$ has $P$.
Proof (of the corollary). Let $\operatorname{Spec}(A)$ be any affine open of $X$. Cover $U$ by a finitely many principal opens $\operatorname{Spec}(A_{g_i})$ such that each of them is principal in some $\operatorname{Spec}(A_i)$ (by affine communication lemma and quasi-compactness of affine schemes). By the first condition, each $\operatorname{Spec}(A_{g_i})$ has $P$, by the second condition, $\operatorname{Spec}(A)$ has $P$ too.
Thanks to the affine communication lemma, it is sufficient to prove that if $\operatorname{Spec}(A) = \bigcup_{i=1}^n \operatorname{Spec}(A_{f_i})$ and each $f^{-1}(\operatorname{Spec}(A_{f_i}))$ is affine, then $f^{-1}(\operatorname{Spec}(A))$ is affine. That is, we reduce to the case $Y= \operatorname{Spec}(A)$ is affine and have to prove $X$ is affine.
Now is the point where you should use exercise II.2.17 in Hartshorne as suggested by hm2020. For each $f \in \Gamma(X,\mathcal{O}_X)$, let $$X_f = \left \{x \in X \mid f \neq 0 \in \mathcal{O}_{X,x}/\mathfrak{m}_x \right \}.$$ and we have to find $g_1,...,g_n \in \Gamma(X,\mathcal{O}_X)$ so that $X_{g_i}$ are affine and $(g_1,...,g_n) = \Gamma(X,\mathcal{O}_X)$. Here you can cheat a little by "pretending" that $X$ is affine to find $g_i$ from $f_i$. Comment if you cannot do this.