Final_Assignment_Template / tools_reverse.py
Rishhix's picture
Create tools_reverse.py
55ec3bd verified
Raw
History Blame Contribute Delete
294 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]