Solution (source code)

= Solution

A standard sufficient hypothesis is that $X$ is both a <Noetherian scheme> and an <integral scheme>, and is <regular in codimension one>; in particular, a Noetherian <normal scheme> qualifies. A <Weil divisor> is then a finite sum
$$
D=\sum_Zn_Z[Z],\qquad n_Z\in\mathbb Z,
$$
over integral codimension-one closed subschemes $Z$. The local ring at the generic point of each $Z$ is a <discrete valuation ring>, so every nonzero <rational function> $g\in k(X)^\times$ has a <principal divisor>
$$
\operatorname{div}(g)=\sum_Zv_Z(g)[Z].
$$
The <divisor class group> is
$$
\boxed{\operatorname{Cl}(X)=\operatorname{Div}(X)/\operatorname{Prin}(X).}
$$