Question: Hey I needed some help on the simplify function I was wondering if I could get some guidance on how to solve it. 4. format_number

Hey I needed some help on the simplify function I was wonderingHey I needed some help on the simplify function I was wondering if I could get some guidance on how to solve it.

4. format_number (num) It takes a non-negative number as a parameter and returns a string representing the same number with commas inserted properly as thousand separator. You are not allowed to use any formatting library/function provided in python. \[ \begin{array}{l} \text { format_number (1) } \\ \gg \text { format_number (11) } \\ \text { '11, } \\ \text { '12' } \\ \text { '123' } \\ \text { ' } 1 \text {, 234' } \\ \text { '12, } 345^{\text {' }} \\ \text { \ format_number (123456) } \\ \text { ' } 123,456 \text { ' } \\ \gg \text { format_number (1234567) } \\ \text { ' } 1,234,567 \text { ' } \\ \end{array} \] 5. simplify (directions) You are given directions to drive from a source to a destination. The directions are a combination of "East", "West", "South", and "North". Obviously, driving to one direction and driving back in the opposite direction is a waste of time. So you want to eliminate the useless steps so that you have only the necessary directions to the destination. Write a function simplify that takes a list of directions and returns the simplified version of it. ['WEST'] simplify (["NORTH", "SOUTH", "SOUTH", "EAST", "NORTH", "WEST", "NORTH", "WEST"] ['NOATH', "WEST'] > simplify (["NORTH", "EAST", "SOUTH", "WEST"])

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!