+ 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
5 ответов
+ 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
0
Solution
mess = input()
message =""
alphabet=" 1234567890abcdefghijklmnopqrstuvwxyz"
for i in mess :
for j in alphabet :
if i == j or i == j.upper ():
message += i
print(message)