# John B. Schneider # CptS 111 # 1/24/2012 # HW 3C # Program to exercise the capabilities of the function fixed_precision(). def main(): x = eval(input("Enter a numeric expression: ")) print("Using print() = ", x) n = int(input("Enter desired number of digits: ")) print("Using fixed_precision() = ", end="") fixed_precision(x, n) def fixed_precision(x, n): int_part = int(x) x = x - int_part frac_part = int(x * 10 ** n) print(int_part, ".", frac_part, sep="") def main(): x = eval(input("Enter a numeric expression: ")) print("Using print() = ", x) n = int(input("Enter desired number of digits: ")) print("Using fixed_precision() = ", end="") fixed_precision(x, n) main()