Question: 4. Below, we define a class called Bit. Write 2 stand-alone functions (not methods of Bit): . flipBits: Takes one list as input, where each

 4. Below, we define a class called Bit. Write 2 stand-alone

4. Below, we define a class called Bit. Write 2 stand-alone functions (not methods of Bit): . flipBits: Takes one list as input, where each element of the list is a Bit. The function should return nothing. but change the given list, so that the value of each Bit object (i.e. its self.v) is changed from 0 to 1 or 1 to 0. o printBittist: Takes one list as input, where each element of the list is a Bit. The function prints out the class Bit: def _init- (self, v-0) self.v def flip (self): self.v_ (self.v + 1) % 2 def-str (self) : return str (self.v) Evanmpler The fllowin ode should rinen 01 L[Bit (1), Bit (0), Bit )] printB t List (L) # Should print: ,101, flipBits (L) printBitList (L) # Should print, 010, ?? should make into ,010

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!