If you have any doubts please comment below. Please give upvote if you like this.
Python Code:
#Import re module
import re
#Method to transform records
def transform_record( record ):
#Apply sub method it replace the pattern math in a string
new_record = re.sub("\d{3}-\d{3}-\d{4}|\d{3}-\d{7}","+1-"+record.split(",")[1],record)
#Return the result string
return new_record
# Here display the results based on problem
print(transform_record("Sabrina Green,802-867-5309,System Administrator"))
print(transform_record("Eli Jones,684-3481127,IT Specialist"))
print(transform_record("Melody Daniels,846-687-7436,Programmer"))
print(transform_record("Charlie Revera,698-746-3357,Web Developer"))

We're working with a csv file, which contains employee information. Each record has a name field,...