+ 2

Results error in code coach problem, spy life in python

code = input('enter your code :-') reverse = code [::-1] encrypt = "" for i in reverse : if i.isalpha() or i.isspace(): encrypt += i print (encrypt) I have done the code, the results are good but it's still giving me errors. I think it's due to the missing space in results. Please help me find what is the error in this code. It's a code coach problem, spy life python

11th Jun 2021, 2:38 PM
Jit Saiba
Jit Saiba - avatar
2 odpowiedzi
+ 2
Jit Saiba , you are very close to get it running properly. you can use your code, but you have to take care about the spaces: ... if i.isalpha() or i == " ": # or you may use : if i.isalpha() or i.isspace(): ...
11th Jun 2021, 3:12 PM
Lothar
Lothar - avatar
+ 5
Spy life python answer 👇 str=input() s=str[::-1] res="" sp="+=%_|<>{}[]!@#$/^&*()\`~-':;,?'" digit="0123456789" for i in sp: s=s.replace (i,"") for i in digit: s=s.replace(i,"") print(s,end=(""))
11th Jun 2021, 2:41 PM
Tharul Nejana
Tharul Nejana - avatar