Created
April 14, 2021 22:30
-
-
Save prasadwrites/f25360e06c06563d9f863bfea27aa90a to your computer and use it in GitHub Desktop.
a1b2 => ['A1B2', 'A1b2', 'a1B2', 'a1b2']
This file contains hidden or 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
| #! /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