Question: using python, the objective is to give each binary bit a weighting and then print this list at the end, i can't use any special

using python,

the objective is to give each binary bit a weighting and then print this list at the end, i can't use any special built in functions.

so far

I have 1 list that has binary such as

100010 which would be my input

i know that with each in this list it counts from 0 so it goes 0,1,2,3,4,5

therefore item 0 in the list is binary bit 1 and end binary bit in my list has a count of 5 in the list

i also have another list which is binary bit weighted list

32,16,8,4,2,1

i know that from this list that 32 is count 0 in my list and 1 is count 5 in my list

i want to give each binary bit input a weighting from the binary bit weighted list

so for instance i want my first input 1 to be weighted as 32

2nd input to be weighted as 16 and so on

then i want it to print only the weighted numbers that would of had a binary linked to it

so input of

100010

should have an output of a list stating

32,2

the issue i'm having is to give each binary bit the weighting from the list of weightings

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!