Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def print_combinations(pattern: str):
- """
- Recursively is called to replace the '?' with '0' and '1' and print combinations
- """
- question_pos = pattern.find("?")
- if question_pos == -1:
- print(pattern)
- else:
- for i in ["0", "1"]:
- print_combinations(pattern[0:question_pos] + i + pattern[question_pos+1:])
- print_combinations("0???1")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement