Closed
Description
The strings/swap_case implementation works only for ASCII letters (since it uses the incomplete regex [^a-zA-Z] to check whether a given characters is a letter). If you provide it with a non-ASCII letter, it will happily swap it and also return the unchanged version.
Example:
➜ strings git:(master) python3 swap_case.py
Please input sentence:This is broken: äü
tHIS IS BROKEN: ÄäÜü
The solution is pretty straightforward - it shouldn't use a regular expression at all, but rely on the built-in Python functions (as it partially already does).
Metadata
Metadata
Assignees
Labels
No labels