feat: reformatted 1.29 and 1.30 with black

This commit is contained in:
baphim
2026-09-30 20:36:13 -04:00
parent bbc75eaf32
commit 57b403f686
3 changed files with 16 additions and 15 deletions
+5 -3
View File
@@ -2,6 +2,8 @@
Write a Python program that outputs all possible strings formed by using the characters 'c', 'a', 't', 'd', 'o', and 'g'
exactly once.
"""
# define 'permute' function
def permute(char_pool, current_str):
# base case: if char_pool is empty, print value of 'current_str'
@@ -11,7 +13,7 @@ def permute(char_pool, current_str):
# try each remaining character as the next pick
for i in range(len(char_pool)):
# pick character at i: pass down pool without it, and string with it added
permute(char_pool[:i] + char_pool[i+1:], current_str + char_pool[i])
permute(char_pool[:i] + char_pool[i + 1 :], current_str + char_pool[i])
permute('catdog', '')
permute("catdog", "")