Step 1: Check the symmetry of the function.
For \(0<x<\pi\), \(f(x)=1\). Check \(f(-x)\) for the same \(x\): here \(-x\) lies in \((-\pi,0)\), where \(f=-1\). So \(f(-x)=-1=-f(x)\). This means \(f\) is an odd function. An odd periodic function has a Fourier series made only of sine terms, the constant term \(a_0=0\) and every cosine coefficient \(a_n=0\).
Step 2: Write the general sine-coefficient formula for period \(2\pi\).
\[ b_n=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\sin(nx)\,dx \]
Because \(f(x)\sin(nx)\) is a product of two odd functions, it is even, so this equals twice the integral over just the positive half:
\[ b_n=\frac{2}{\pi}\int_0^{\pi}1\cdot\sin(nx)\,dx \]
Step 3: Evaluate the integral.
\[ \int_0^{\pi}\sin(nx)\,dx=\left[-\frac{\cos(nx)}{n}\right]_0^{\pi}=\frac{1-\cos(n\pi)}{n} \]
So:
\[ b_n=\frac{2}{\pi}\cdot\frac{1-\cos(n\pi)}{n}=\frac{2(1-(-1)^n)}{n\pi} \]
Step 4: Simplify for even and odd \(n\) separately.
If \(n\) is even, \((-1)^n=1\), so \(1-(-1)^n=0\), giving \(b_n=0\). If \(n\) is odd, \((-1)^n=-1\), so \(1-(-1)^n=2\), giving \(b_n=\dfrac{4}{n\pi}\).
Step 5: Assemble the Fourier series.
Only odd \(n=1,3,5,\dots\) survive, each contributing \(b_n\sin(nx)=\dfrac{4}{n\pi}\sin(nx)\):
\[ f(x)=\frac{4}{\pi}\left[\sin x+\frac{\sin 3x}{3}+\frac{\sin 5x}{5}+\cdots\right] \]
Step 6: Rule out the other options.
Options (C) and (D) both add a constant \(1\), but \(a_0=0\) since \(f\) is odd (it spends equal area at \(+1\) and \(-1\) over one period), so neither can be correct. Option (B) has the right shape but the wrong overall sign, that would describe \(-f(x)\), the mirror image of the given function, not \(f(x)\) itself.
Final Answer:
\[ \boxed{f(x)=\frac{4}{\pi}\left[\sin x+\frac{\sin 3x}{3}+\frac{\sin 5x}{5}+\cdots\right]} \] which is option (A).