Define a Python 3 function shuffle (s, t) that returns the shuffle sllt of strings s and t. Return the result as a set of strings, that is, without duplicates. For example: Test print (sorted (shuffle('ab', 'cd'))) print (sorted (shuffle('', 'e'))) Result ['abcd', 'acbd', 'acdb', 'cabd', 'cadb', 'cdab'] ['e']
Step by step
Solved in 3 steps with 1 images
Hi. Thanks for your answer. Unfortunately, it faild a test case below. Can you please try again?
=====
FAILED TEST CASE:
print(sorted(shuffle('abab', 'baba')))
EXPECTED:
['abababab', 'abababba', 'ababbaab', 'ababbaba', 'abbaabab', 'abbaabba', 'abbabaab', 'abbababa', 'baababab', 'baababba', 'baabbaab', 'baabbaba', 'babaabab', 'babaabba', 'bababaab', 'babababa']
GOT:
['abababab', 'abababab', 'abababab', 'abababba', 'abababba', 'abababba', 'abababba', 'ababbaab', 'ababbaab', 'ababbaab', 'ababbaab', 'ababbaba', 'ababbaba', 'ababbaba', 'ababbaba', 'abbaabab', 'abbaabab', 'abbaabab', 'abbaabab', 'abbaabba', 'abbaabba', 'abbaabba', 'abbaabba', 'abbaabba', 'abbaabba', 'abbaabba', 'abbaabba', 'abbabaab', 'abbabaab', 'abbabaab', 'abbabaab', 'abbababa', 'abbababa', 'abbababa', 'abbababa', 'baababab', 'baababab', 'baababab', 'baababab', 'baababba', 'baababba', 'baababba', 'baababba', 'baabbaab', 'baabbaab', 'baabbaab', 'baabbaab', 'baabbaab', 'baabbaab', 'baabbaab', 'baabbaab', 'baabbaba', 'baabbaba', 'baabbaba', 'baabbaba', 'babaabab', 'babaabab', 'babaabab', 'babaabab', 'babaabba', 'babaabba', 'babaabba', 'babaabba', 'bababaab', 'bababaab', 'bababaab', 'bababaab', 'babababa', 'babababa', 'babababa']