For the code below:
command = '\'{:.' + str(3) + 'f}\'.format(' + str(12.6543423) + ')'
print(command)
print('{:.3f}'.format(12.6543423))
print(exec(command))
Expected results:
'{:.3f}'.format(12.6543423)
12.654
12.654
Actual results:
'{:.3f}'.format(12.6543423)
12.654
None
Please can someone tell me what I'm doing wrong and how to fix it? I'm both trying to write a number rounding function and trying to understand the exec command.