To maintain accuracy, I would probably use the fractions module :
>>> from fractions import Fraction
>>> Fraction(10)
Fraction(10, 1)
>>> Fraction(10)**50
Fraction(100000000000000000000000000000000000000000000000000, 1)
>>> Fraction(10)**50-1
Fraction(99999999999999999999999999999999999999999999999999, 1)
>>> (Fraction(10)**50-1)/23
Fraction(99999999999999999999999999999999999999999999999999, 23)
>>> ((Fraction(10)**50-1)/23) % 1
Fraction(5, 23)
>>> float(((Fraction(10)**50-1)/23) % 1)
0.21739130434782608
although using decimal would be another option.
update: wait, on the other hand, the answer will always be here ((10^n-1) % 23)/23, so the above is a significant excess (although it is better suited for more complex problems). We can even take advantage of three pow call arguments:
>>> pow(10, 50, 23)
6
>>> pow(10, 50, 23) - 1
5
>>> (pow(10, 50, 23) - 1) % 23
5
>>> ((pow(10, 50, 23) - 1) % 23) / 23.0
0.21739130434782608