To solve for \( y \) given the equation \( y = \frac{1}{2} x + 2 \), we can create a function in Python that takes \( x \) as an input and returns the corresponding \( y \) value.
Step 1: Given Equation
We start with the linear equation given by \( y = \frac{1}{2} x + 2 \).
Step 2: Substitute \( x \)
To find the value of \( y \) when \( x = 4 \), we substitute \( x \) into the equation:
\[
y = \frac{1}{2} \cdot 4 + 2
\]
Step 3: Calculate \( y \)
Now, we perform the calculation:
\[
y = 2 + 2 = 4
\]
Final Answer
Thus, for \( x = 4 \), the value of \( y \) is
\[
\boxed{y = 4}
\]