Final_Assignment_Template_Pai / tools_reverse.py
Yashrajnpai's picture
Create tools_reverse.py
1c9ffb9 verified
raw
history blame contribute delete
295 Bytes
import re
def flip_hidden(question):
# Reverse only the text before '.rewsna' if present
match = re.search(r'^(.*)\.rewsna', question)
if match:
to_flip = match.group(1)
return to_flip[::-1].strip()
# Fallback: reverse the whole string
return question[::-1]