Nomor pembulatan Python ke N digit

def roundTraditional(val,digits):
   return round(val+10**(-len(str(val))-1), digits)
Embarrassed Eel