https://www.sololearn.com/coach/55?ref=app | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

https://www.sololearn.com/coach/55?ref=app

How to detect space in this problem??🤔🤔(Code Coach:Spy Life)

13th Sep 2020, 8:33 AM
Wahid Kabir
Wahid Kabir - avatar
1 Answer
+ 2
This the code I wrote for this challange: text = input() result = "".join(c for c in text if c.isalpha() or c == " ") print(result[::-1]) You can either write c == " " or c.isspace. if c.isalpha detects all alphabetical characters and if c.isspace detects white spaces in the c.
13th Sep 2020, 8:43 AM
pedram ch
pedram ch - avatar