Question: ( 3 5 ) Write a function binInvert ( ) . The function takes a string as its parameter. It should convert every occurrence of

(35) Write a function binInvert(). The function takes a string as its parameter. It should convert every occurrence of 1 to 0, and every occurrence of 0 to 1. Then it should return the new string. You may assume that the string only contains 0s and 1s.
Hint: Use the replace method.
You may test the function with this statement:
print( binInvert("01110011"))
If the output is 10001100, then your function is okay.

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 Accounting Questions!