Regular Expression | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Regular Expression

I think there is something that is quite confusing. In the code "import re str = "My name is David. Hi David." pattern = r"David" newstr = re.sub(pattern, "Amy", str) print(newstr) you define a variable str, which I did not pay attention, but is a variable type, so first Its not the best name for a variable. I honestly did not pay attention to that, and thought that after Amy I had to declare the replacement type, I was quite lost about it. Until when asked for a hint and an "n" appear. I think It would be nice to change the variable name, so its not misleading. Also, I think calling a variable using a type its not correct at all. Thanks, all the course is a amazing Pablo.

23rd Jul 2020, 2:04 PM
Pablo Puente
Pablo Puente - avatar
1 Answer
+ 1
You are right! However, Sololearn devs might not see this thread. For this kind of suggestions you should send a mail to [email protected], providing the complete explanation of the issue and the lesson link too if possible. You did well pointing it out. Hopefully they'll fix it in next updates. Thanks. Please remove your duplicate thread to keep the forum organized: https://www.sololearn.com/Discuss/2409545/?ref=app
24th Jul 2020, 5:39 AM
Kevin ★