Ask Question

Write a python function c that converts bitstring array back to an integer numpy array

+4
Answers (1)
  1. 7 June, 17:50
    0
    import numpy as np#importing numpy module with an alias np.

    def c (bitstring_array) : # defining function c.

    num_integer=bitstring_array. dot (2**np. arange (bitstring_array. size) [::-1]) #bitstring conversion.

    return num_integer#returning integer array.

    print ("Enter bits")

    Bit_l=input (). split (" ") #enter space separated bitstring.

    for i in range (len (Bit_l)) : #iterating over the bitstring.

    Bit_l[i]=int (Bit_l[i])

    bitstring_array=np. array (Bit_l)

    print (c (bitstring_array)) #function call.

    Output:

    Enter bits

    1 1 1 0 0 1

    57
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a python function c that converts bitstring array back to an integer numpy array ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers