Question: 4. Let us extend the problem from the previous module. Given a positive n-digit number, write a Python function that will return its rearranged digits

4. Let us extend the problem from the previous module. Given a positive n-digit number, write a Python function that will return its rearranged digits such that the value of digits are in descending order from left to right. For example, 87976 returns 98776 and 6740 returns 7640. Note: No import is allowed for this problem. 5. The bitwise logical operation NAND takes two strings and compares each character in their respective positions as follows: if both of the characters is a "1", the corresponding character in the resulting string is a "0"; otherwise it is a "1". Example: "10010001" NAND "10010010" becomes "01101111". Implement a Python function that accepts arbitrary string length composed of "0"s and "1"s only. Both string inputs must have the same length. In [ ] : 1 \# DO NOT MODIFY, THIS IS UNIT TESTING! assert bitwise_NAND("0010011011", "1010000011") == " 1101111100 " assert bitwise_NAND("11100000", "00011111") == "1111111" assert bitwise_NAND("1010101", "1111000") == " 0101111 " assert bitwise_NAND ("1"," ") == "1" 7 In [ ]: 1 \#SAMPLE TEST, DO NOT MODIFY, JUST EXECUTE ONLY FOR OUTPUT bitwise_NAND("0110110010010010", "1111110000110111")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
