Please help me out with symbols code coach problem | Sololearn: Learn to code for FREE!

+5

Please help me out with symbols code coach problem

I can't put spaces in-between the words and prevent it from printing three times. https://code.sololearn.com/cY3Q86IPrYZd/?ref=app

6/10/2020 9:12:18 PM

Chinyere [Inactive]

4 Answers

New Answer

+7

Maybe just add a condition for i==' ' apart from it being isalnum(). Then it won't get cleared and so you won't need to add it again later on.

+5

check for spaces as well res_str=[i for i in str if i.isalnum() or i==" "]

+1

Chinyere [Inactive] Try: "([a-zA-Z0-9 ]*)" note there is a space after the 9

0

Just add break at the bottom-most part of the for loop