Let $a$ have a decimal expansion that ultimately becomes periodic, i.e.$$a=\lfloor a\rfloor\color{red}.d_1d_2\cdot\cdot\cdot d_n\overline{q_1q_2\cdot\cdot\cdot q_p}$$where $d_i,q_j$ are digits after the decimal point and $p$ is the period of the decimal representation. Thus,$$10^n\cdot a=\lfloor a\rfloor d_1d_2\cdot\cdot\cdot d_n\color{red}.\overline{q_1q_2\cdot\cdot\cdot q_p}\\10^{n+p}\cdot a=\lfloor a\rfloor d_1d_2\cdot\cdot\cdot d_nq_1q_2\cdot\cdot\cdot q_p\color{red}.\overline{q_1q_2\cdot\cdot\cdot q_p}$$Subtracting the two numbers will get rid of the periodic part, as under:$$(10^{p}-1)10^n\cdot a=\lfloor a\rfloor d_1d_2\cdot\cdot\cdot d_nq_1q_2\cdot\cdot\cdot q_p-\lfloor a\rfloor d_1d_2\cdot\cdot\cdot d_n\\\implies a=\frac{\lfloor a\rfloor d_1d_2\cdot\cdot\cdot d_nq_1q_2\cdot\cdot\cdot q_p-\lfloor a\rfloor d_1d_2\cdot\cdot\cdot d_n}{(10^{p}-1)10^n}$$which is of the form $\frac pq;p,q\in\Bbb Z,q\ne0$.
Consider, for example, $a=3.4\overline{56}\implies 10a=34.\overline{56},1000a=3456.\overline{56}$ and $1000a-10a=990a=3456-34=3422$. Thus, $a=3422/990=1711/495$ and $a^{-1}=495/1711$. You can verify this by finding the decimal representation of $1711/495$.