Question
Python import re and use regex Replace the word Boy/Girl or boy/girl with Man/Woman. 1. Boy/Girl or boy/girl should be replaced with Man/Woman if the
Python import re and use regex
Replace the word Boy/Girl or boy/girl with Man/Woman.
1. Boy/Girl or boy/girl should be replaced with Man/Woman if the word prior to it is a name (starts with a capital letter)
Here are some examples:
Spider Girl, I need help!
Should return
Spider Woman, I need help!
There is a boy trapped in a burning building Iron Boy
Should return
There is a boy trapped in a burning building Iron Man
This is because the first boy is not proceeded by a word that has a Capital letter
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started