+ 4

import re n=input()[::-1] pattern=r"[A-Za-z]" s=re.findall(pattern,n) o=("".join(s)) print (o)

Spy Life Problem (i am stuck here) (needing help)

29th Aug 2021, 12:57 PM
Norberto Costa
Norberto Costa - avatar
12 odpowiedzi
+ 3
SoloProg what is different between yours code and Norberto Costa code ??
29th Aug 2021, 1:07 PM
Pariket Thakur
Pariket Thakur - avatar
+ 3
Simply add the space to the regex. pattern=r"[A-Za-z ]"
29th Aug 2021, 1:56 PM
SoloProg
SoloProg - avatar
+ 2
The code has to be decoded word by word(my answer: youaregreat, problem answer: you are great.
29th Aug 2021, 1:13 PM
Norberto Costa
Norberto Costa - avatar
+ 2
Norberto Costa try this import re str_ = input() pattern = r"[^A-Za-z ]" newstr = re.sub(pattern, "", str_) print(newstr[::-1])
29th Aug 2021, 1:14 PM
Pariket Thakur
Pariket Thakur - avatar
+ 1
Norberto Costa spy life task is to flip input value For example: hello Output: olleh 2. Hello world Output: dlrow olleH Re.sub is used  to remove punctuation and give space by using your code we are not getting the space for example: hello world Output: dlrowolleH ✖️ 2. helloworld Output: dlrowolleH ✔️
29th Aug 2021, 1:40 PM
Pariket Thakur
Pariket Thakur - avatar
+ 1
Thanks, Hr
29th Aug 2021, 1:47 PM
Norberto Costa
Norberto Costa - avatar
+ 1
Its solved. Thanks
29th Aug 2021, 3:14 PM
Norberto Costa
Norberto Costa - avatar
+ 1
SoloProg have reason
31st Aug 2021, 2:36 AM
CGO!
CGO! - avatar
+ 1
Norberto Costa or... import re print(''.join(map(str, re.findall("([a-zA-Z ]*)", input()[::-1]))))
31st Aug 2021, 2:39 AM
Paul K Sadler
Paul K Sadler - avatar
0
import re n=input()[::-1] pattern=r"[A-Za-z]" s=re.findall(pattern,n) o=("".join(s)) print (o)
29th Aug 2021, 1:03 PM
SoloProg
SoloProg - avatar
0
HrCoder your code works. But seriously i do not understand why?
29th Aug 2021, 1:26 PM
Norberto Costa
Norberto Costa - avatar
0
How the method sub knows when to put space?
29th Aug 2021, 1:27 PM
Norberto Costa
Norberto Costa - avatar