+ 2
The Spy Life from code couch. Help
import re text = str(input()) result = re.sub(r"[^\w]", "", text, flags=re.I) res = re.sub(r"\d", "", result, flags=re.I) def reverse(res): res = res[::-1] return res print (reverse(res)) #how can i not delete the spaces, without mentioning each symbol to remove?
12 odpowiedzi
+ 4
I found it at last.
https://code.sololearn.com/ctKXCQL5E0Zv/?ref=app
+ 4
Instead of trying to delete you can find just the strings and spaces instead. For example
import re
inp = input()
print(''.join(re.findall(r'[a-zA-Z]|\s', inp[::-1])))
+ 2
This was my answer:
https://code.sololearn.com/ci6RSHBA024d/?ref=app
+ 2
My solution of "The Spy Life":
code_text = input()
uncode_text = ""
number = -1
while number >= -(len(code_text)):
if code_text[number].isalpha() == True or code_text[number].isspace():
uncode_text += code_text[number]
number -= 1
print(uncode_text)
What are You thinking about?
+ 1
My code :)
https://code.sololearn.com/c5qv6PFMxGko/#py
+ 1
Not fancy but it works :
x=input()
y=x[::-1]
z='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '
for i in y:
if i in z:
print(i, end='')
else:
print('', end='')
0
num=input()
alph="abcdefghijklmnopqrstuvwxyz"
p=""
q=""
for i in num:
if i==" ":
p+=" "
if i in alph:
p+=i
for k in range(len(p)):
q+=p[-k-1]
print(q)
0
This works too:
import re
txt = input()
pattern = r'[a-zA-Z\s]'
ans = re.findall(pattern, txt)
anss = ans.reverse()
print("".join(ans))
0
import re
x=input()
x=re.sub('[^a-zA-Z\s]', '',x)[::-1]
print(x)
0
Nowadays, it is very easy to follow someone else's life using social networks or a smartphone. I am very worried about this and I am afraid of hackers who are everywhere, so I use the recommendations https://theteensafe.com/iphone-keylogger/ , there is everything about the protection of all social networks and the smartphone. I found it useful and I want to share it with you.
0
import re
encrypt=input()
pattern=re.compile("^[a-zA-Z\s]")
w=[]
c=0
for i in encrypt:
match=re.search(pattern,i)
if match:
w.append(i)
c+=1
w.reverse()
print("".join(w))
0
This code I wrote to validate my answer