Question: I need to fill in the function problem3 in python using regular expressions ASAP !! The definition of the function is given as def problem3(searchstring).
I need to fill in the function problem3 in python using regular expressions ASAP !! The definition of the function is given as def problem3(searchstring). I will give thumbs up rating if this function works as expected :) Thank you !!


Problem 3: Substitution Fill in the function problem3. This function should garble addresses by returning the original address but with the street name reversed. For some of the above examples, you should return: The EE building is at 465 nretsewhtron Ave. Meet me at 201 tsrif htuos St. at noon (Note that the entire street name is reversed, not word by word) and, if your input is Go West on 999 West St. , you should return: Go West on 999 tsew St. (Note that only the street name is reversed). Two hints: 1. Think about creating three groups in your regular expression. One that captures the street number, one that captures the street name, and one that captures the road type. You can then use those three groups to assemble the appropriate 2. If you have a string s, s[::-1] is the reversed string. You should feel free to write helper functions to help solve this problem. Be careful not to return extra spaces in the final output. You may need to do a little bit of extra processing of the string captured by your group to ensure this. You will receive partial credit for having unwanted spaces. Please remove extra spaces for full credit. def problem3 (searchstring): II II 11 Garble Street name. :param searchstring: string :return: string
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
