+ 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

10th Jun 2020, 9:12 PM
Chinyere Unamba
Chinyere Unamba - avatar
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.
10th Jun 2020, 9:25 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 5
check for spaces as well res_str=[i for i in str if i.isalnum() or i==" "]
10th Jun 2020, 9:25 PM
Abhay
Abhay - avatar
+ 1
Chinyere [Inactive] Try: "([a-zA-Z0-9 ]*)" note there is a space after the 9
1st Feb 2021, 3:49 AM
Paul K Sadler
Paul K Sadler - avatar
0
Just add break at the bottom-most part of the for loop
15th Apr 2021, 10:56 AM
Einstein IJ
Einstein IJ - avatar
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)
5th May 2023, 11:37 AM
Oussama Kadimallah
Oussama Kadimallah - avatar