Skip to main content
1 of 2
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Python 2 + SymPy, 68 bytes

from sympy import*
lambda s,p:`Rational(s).round(p)`[:-0**p or None]

Try it online!

Dennis
  • 210.6k
  • 41
  • 370
  • 825