Question: According to the hint, fix and finish the binary_string function (python). Complete the function binary_string(intput_integer, storage_bits=32) which (when possible) returns a binary string representation of

According to the hint, fix and finish the binary_string function (python). CompleteAccording to the hint, fix and finish the binary_string function (python).the function binary_string(intput_integer, storage_bits=32) which (when possible) returns a binary string representation

Complete the function binary_string(intput_integer, storage_bits=32) which (when possible) returns a binary string representation of the supplied integer where the leftmost bit is the + sign bit and the rightmost bit is 20. This problem is inspired by Figure 2.1 of Chapter 2.1 The Fixed-Point Number System on page 86 of James E. Gentle's Computational Statistics textbook, and is additionally intended as a way to help folks get started with Python if they're not yet familiar with it. In [1]: Python code doesn't ru if it's not consistently indented # This syntax defines the fuction binary_string with a required and optional input. # Input values are accessed in the function as variables integer_input'storage_bits. # Unless specified upon calling the function, optional input values get default values. def binary_string(integer_input, storage_bits=16): #docstring syntax: run binary_string?" (without ticks) in a cell to veiw this *** integer_input: must be an integer which may be negative storage_bits : representational storage limits*** # The type of Python variables are automatically determined # e. g., the type of the variable storage_bits=16' is 'int e. g., these return True or False bool type values: type (integer_input)=int integer_input is int if type (integer_input) is not int: # if type (integer_input) != int: return "Error: this function takes integers only. maximum_representable_integer = 2** (storage_bits) # FIX THIS: it's not correct!!! # Here's another standard if statement usage example if abs(integer_input) > maximum_representable_integer: return "Error: `integer_input" exceeds the representational capability of storage_bits". " bits = storage_bits* [0] if integer_input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!