Created
October 29, 2020 23:35
-
-
Save kremerben/7668079830f191df3fb6e33dd047dc13 to your computer and use it in GitHub Desktop.
InpUT a StRINg, reTUrN a stRINg with rANDoM upPer or lOWER caSE.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def case_scram(str_): | |
""" inpUT a StRINg, reTUrN a stRINg with rANDoM upPer or lOWER caSE. | |
This was built for testing case-insensitivity. | |
""" | |
from random import choice | |
if not isinstance(str_, str): | |
return str_ | |
return "".join(choice((c.upper(), c.lower())) for c in str_) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment