+ 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)
12 Antworten
+ 3
SoloProg what is different between yours code and Norberto Costa code ??
+ 3
Simply add the space to the regex.
pattern=r"[A-Za-z ]"
+ 2
The code has to be decoded word by word(my answer: youaregreat, problem answer: you are great.
+ 2
Norberto Costa try this
import re
str_ = input()
pattern = r"[^A-Za-z ]"
newstr = re.sub(pattern, "", str_)
print(newstr[::-1])
+ 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 ✔️
+ 1
Thanks, Hr
+ 1
Its solved. Thanks
+ 1
SoloProg have reason
+ 1
Norberto Costa or...
import re
print(''.join(map(str, re.findall("([a-zA-Z ]*)", input()[::-1]))))
0
import re
n=input()[::-1]
pattern=r"[A-Za-z]"
s=re.findall(pattern,n)
o=("".join(s))
print (o)
0
HrCoder your code works. But seriously i do not understand why?
0
How the method sub knows when to put space?