1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
arlik [135]
3 years ago
5

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

Computers and Technology
1 answer:
tresset_1 [31]3 years ago
6 0

Answer:

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

You might be interested in
Your task is to build a palindrome from an input string.A palindrome is a word that readsthe same backward or forward. Your code
White raven [17]

Answer:

The program in Python is as follows:

word = input("Word: ")

if len(word) < 5:

   print("At least 5 characters")

else:

   pal = word[0:5]

   word = word[0:4]

   word = word[::-1]

   pal+=word

   print(pal)

Explanation:

This gets the word from the user

word = input("Word: ")

This checks if the length of the word is less than 5.

if len(word) < 5:

If yes, this tells the user that at least 5 characters is needed

   print("At least 5 characters")

If otherwise

else:

This extracts the first 5 characters of the word into variable named pal

   pal = word[0:5]

This extracts the first 5 characters of the word into variable named word

   word = word[0:4]

This reverses variable word

   word = word[::-1]

This concatenates pal and word

   pal+=word

This prints the generated palindrome

   print(pal)

7 0
3 years ago
The ________ is the biggest power consumer on a mobile computing device. display CPU memory module hard drive
user100 [1]

Answer:

CPU (Central Processing Unit)

6 0
2 years ago
Is there any website online to use android studio live?​
slavikrds [6]

Answer:

May bhe here

https://developer.android.com/studio/intro

Explanation:

5 0
3 years ago
John Cleaver is the CEO of Tech World, which is a retail store that sells computers, monitors, cameras, televisions and many oth
Norma-Jean [14]
The answer would be b. Contemplate other products to introduce at the same time in this new market.
5 0
3 years ago
How can i fix this, if i log in my acc it keeps saying wrong nickname or pass. even though my email and pass is correct
Oksanka [162]

Answer:

미안해요. 나는 우리가 단지 부동일 중 하나를 모르지만 그것을 해결하는 방법을 모른다!.

8 0
3 years ago
Other questions:
  • What can help you best learn about appearance, habitats and behaviors of birds in your area
    9·1 answer
  • Oxygen-18 has an atomic number of 8. How many neutrons are in this isotope?
    7·1 answer
  • Whenever Jim starts his laptop, he sees some commands and numbers appearing on his screen. These instructions are being processe
    12·2 answers
  • If $hourlyWage contains the value 10.00 and $hoursWorked contains the value 20, what value will $bonus contain after the followi
    11·1 answer
  • To execute a prepared SQL statement, you can use the ________________ and execute() methods of the PDOStatement object to set pa
    10·1 answer
  • To filter a list with the Filter function, on an Excel spreadsheet, you need to perform the following steps: (1) click in any ce
    9·1 answer
  • If you play gta and don't know the song ''Glamorous'' Then what do you even do when you play?
    6·2 answers
  • Where does the turtle belong in the cladogram shown below?<br> I’LL GIVE YOU BRAINLYEST
    6·2 answers
  • What is algorithm and how does it works​
    11·2 answers
  • What type of task can be defined to allow you fine-grained control over the management tasks a user can perform in an OU
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!