Skip to content

Instantly share code, notes, and snippets.

@prasadwrites
Created April 14, 2021 22:30
Show Gist options
  • Select an option

  • Save prasadwrites/f25360e06c06563d9f863bfea27aa90a to your computer and use it in GitHub Desktop.

Select an option

Save prasadwrites/f25360e06c06563d9f863bfea27aa90a to your computer and use it in GitHub Desktop.
a1b2 => ['A1B2', 'A1b2', 'a1B2', 'a1b2']
#! /usr/env/path python
def helper(string, result, index , slate):
if (len(string) == len(slate)):
result.append(slate)
return
if(string[index].isdigit()):
slate = slate + str(string[index])
helper(string, result, index+1, slate)
slate = slate[:-1]
else:
slate= slate + str(string[index].upper());
helper(string, result, index+1, slate)
slate = slate[:-1]
slate = slate + str(string[index].lower())
helper( string, result, index+1, slate)
result =[]
helper("a1b2",result, 0 , "")
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment