+ 2
(Answered) Why isn't my spy life code passing test case 3
def strip_chars(str, chars): return "".join(c for c in str if c not in chars) x = input() print(strip_chars(x[::-1], "1234567890@@##$__&&--++//**::;;!!??~~``||••√√ππ÷÷×׶¶∆∆££¢¢€€¥¥^^°°==\\%%©©®®™™✓✓<<>>..,,"))
11 Antworten
+ 3
I think you can do like this,
def strip_chars(st):
return "".join(c for c in st if c.isalpha() or c.isspace())
+ 2
What symbol am I missing
+ 2
Sorry I'm a beginner what will the re module do
+ 2
Thank you all so much
+ 2
OK, Nathan. There is no problem to be novice here.
I mean regular expression library, it is imported as "import re" in the first line of your program.
https://code.sololearn.com/cZoQ2etDRNxa/?ref=app
+ 2
I hide the line "x = input()" and added x from the challenge.
You can uncomment it.
+ 1
You should import re.
+ 1
Nathan, I am confused asking: why did you write twice every symbol in chars?
+ 1
It wasn't working with singular on my computer's IDE and I read somewhere if you repeat some symbols it would work
0
Would be it not easier to turn over your solution and test a character if it is letter or space?