Number arranger
The solution can be found below: import operator (The example above shows what this should look like.) The dashes should run along the entire length of each problem individually. There should be dashes at the bottom of each problem.There should be four spaces between each problem.There should be a single space between the operator and the longest of the two operands, the operator will be on the same line as the second operand, both operands will be in the same order as provided (the first will be the top one and the second will be the bottom.If the user supplied the correct format of problems, the conversion you return will follow these rules: Otherwise, the error string returned will be: Error: Numbers cannot be more than four digits. Each operand (aka number on each side of the operator) has a max of four digits in width.Otherwise, the function will return: Error: Numbers must only contain digits.
When the second argument is set to True, the answers should be displayed.įunction Call: arithmetic_arranger()įunction Call: arithmetic_arranger(, True) The function should optionally take a second argument. For example, "235 + 52" becomes: 235Ĭreate a function that receives a list of strings that are arithmetic problems and returns the problems arranged vertically and side-by-side. Students in primary school often arrange arithmetic problems vertically to make them easier to solve. Here is the arithmetic arranger question click here to access the question and the detailed question can be found below: I tried my hand at the freecodecamp python algorithm and I came up with a solution for the first question but need help refactoring it.