• brute_force_blackout(line): Takes one string corresponding to a valid mathematical equation as input. Continuously tries to remove two different characters (digits or operations, except the equals...


In python please


• brute_force_blackout(line): Takes one string corresponding to a valid mathematical equation as<br>input. Continuously tries to remove two different characters (digits or operations, except the equals<br>sign) from the original string until the equality holds in the resulting string. If one can be found,<br>then return the equation (with the two characters removed) as a list of tokens. (Note that the<br>resulting list of tokens must contain strings whose total lengths add up to the length of the original<br>string's length minus two.) If such a string cannot be found after trying all possible combinations<br>of characters, then return None instead.<br>>>> brute_force_blackout('6-5=15^4/2')<br>[6, '-', 5, '=', 1, '^', 42]<br>>>> brute_force_blackout('288/24x6=18x13x8')<br>[288, '/', 4, 'x', 6, '=', 18, 'x', 3, 'x', 8]<br>>>> result = brute_force_blackout('4-3=0')<br>>>> print(result)<br>None<br>

Extracted text: • brute_force_blackout(line): Takes one string corresponding to a valid mathematical equation as input. Continuously tries to remove two different characters (digits or operations, except the equals sign) from the original string until the equality holds in the resulting string. If one can be found, then return the equation (with the two characters removed) as a list of tokens. (Note that the resulting list of tokens must contain strings whose total lengths add up to the length of the original string's length minus two.) If such a string cannot be found after trying all possible combinations of characters, then return None instead. >>> brute_force_blackout('6-5=15^4/2') [6, '-', 5, '=', 1, '^', 42] >>> brute_force_blackout('288/24x6=18x13x8') [288, '/', 4, 'x', 6, '=', 18, 'x', 3, 'x', 8] >>> result = brute_force_blackout('4-3=0') >>> print(result) None

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here