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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started