Import numpy AS NP from decimal Import * # Set the number of bits n-int = (INPUT ( " Please enter the number of bits: " )) getContext () prec. =. 1 + n- # square root Result = np.sqrt (a Decimal (2 )) # number into a string and extracts the last End = STR (result) [-. 1 :] # printing result Print ( " squared result: " , result) Print ( " total data after the decimal point: " , len (STR ( Result)) - 2 ) Print ( " one decimal digit {}: {} " .format (n-, End))
Test results: 10
Test results: 1,000,000