Skip to content

Instantly share code, notes, and snippets.

@kremerben
Created October 29, 2020 23:35
Show Gist options
  • Save kremerben/7668079830f191df3fb6e33dd047dc13 to your computer and use it in GitHub Desktop.
Save kremerben/7668079830f191df3fb6e33dd047dc13 to your computer and use it in GitHub Desktop.
InpUT a StRINg, reTUrN a stRINg with rANDoM upPer or lOWER caSE.
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