Ask Question
24 December, 16:53

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

+2
Answers (1)
  1. 24 December, 17:34
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers