From d23b39d9844c7919c2a86b12e6067ae97f80ad84 Mon Sep 17 00:00:00 2001 From: baphim <269010393+baphim@users.noreply.github.com> Date: Wed, 30 Sep 2026 15:53:03 -0400 Subject: [PATCH] feat: completed P-1.29 --- lab-3_4/P-1.29.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lab-3_4/P-1.29.py b/lab-3_4/P-1.29.py index eb94f53..0af3010 100644 --- a/lab-3_4/P-1.29.py +++ b/lab-3_4/P-1.29.py @@ -1,4 +1,14 @@ """ -Write a Python program that outputs all possible strings formed by using the chagacters 'c', 'a', 't', 'd', 'o', and 'g' +Write a Python program that outputs all possible strings formed by using the characters 'c', 'a', 't', 'd', 'o', and 'g' exactly once. -""" \ No newline at end of file +""" + +def permute(char_pool, current_str): + if len(char_pool) == 0: + print((current_str)) + return + for i in range(len(char_pool)): + permute(char_pool[:i] + char_pool[i+1:], current_str + char_pool[i]) + + +permute('catdog', '') \ No newline at end of file