Question: I am using Python language in Pycharm. Part III: Are You a Permutation? (3 points) A permutation of a list or string is a rearrangement
I am using Python language in Pycharm. Part III: Are You a Permutation? (3 points) A permutation of a list or string is a rearrangement of the elements in the list or string. For example, given the list [1,2,3,4], permutations would include [2,4,1,3], [4,3,1,2] and [3,2,4,1]. Likewise, given the string dome, permutations would include edom, emod and mode. Write a function permutations() that takes a string argument, opens the file words.txt (provided on Blackboard) and returns a list consisting of all permutations of the string argument found in the file (if any). The original word should not be included in the returned list. The function may return the words in any order inside the list. Examples: Function Call Return Value permutations(veil) [evil, levi, live, vile] permutations(tori) [riot, trio] permutations(dad) [add] permutations(ado) []
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
