Question: 7 . 6 . 2 : Recursive exploration of all possibilities. 3 8 2 8 2 8 3 7 7 4 1 1 2 9
: Recursive exploration of all possibilities.
Jump to level
Strings are read from input and stored in list namestopick. The recursive function ordernames explores all possible
arrangements of the names in namestopick. In ordernames write the base case to output each element in list pickednames
if the size of list remainnames is Output a space after each element. Keep the output of the explored combination in one line.
Click here for example
def ordernamesremainnames, pickednames:
else:
for i val in enumerateremainnames:
newremain remainnames :remain names :
newpicked pickednames
ordernamesnewremain, newpicked
names to pick
picks
for token in input split:
names to pick.append token
printAl possible arrangements:
ordernames namestopick, picks
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
