human
function to round to variable number of digits.
assistant
Here is a Python function to round to a variable number of digits

import math

def round_to_n_digits(number, n):
    """
    Round to n digits.
    """
    return round(number, n)

# Enter the number
number = 123.456789

# Calling the function
print((round_to_n_digits(number, 2)))

#Example Output
# 123.46

#Remember to inspect code for bugs.