← Back to challenges

Reverse String Without Affecting Special Characters

PythonHardlogicstringsregex

Instructions

Reverse the string without affecting special characters and numbers.

Examples

rev_specstring("AFC#47GH$Ieu") ➞ "ueI#47HG$CFA"

rev_specstring("guyhiuj1234!@#$%rtyhghu") ➞ "uhghytr1234!@#$%juihyug"

rev_specstring("12!@" ) ➞ "12!@"

Notes

Try with for loops.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.