Question: 7 . 6 . 2 : Recursive exploration of all possibilities. 3 8 2 8 2 8 3 7 7 4 1 1 2 9

7.6.2: Recursive exploration of all possibilities.
3828283774112932947
Jump to level 1
Strings are read from input and stored in list names_to_pick. The recursive function order_names() explores all possible
arrangements of the names in names_to_pick. In order_names(). write the base case to output each element in list picked_names
if the size of list remain_names is 0. Output a space after each element. Keep the output of the explored combination in one line.
Click here for example
def order_names(remain_names, picked_names):
else:
for i, val in enumerate(remain_names):
new_remain = remain_names [:i]+remain names i+1:
new_picked = picked_names +[val]
order_names(new_remain, new_picked)
names to pick =[]
picks =[1]
for token in input(). split():
names to pick.append (token)
print('Al ?bar(1) possible arrangements:')
order_names (names_to_pick, picks)
 7.6.2: Recursive exploration of all possibilities. 3828283774112932947 Jump to level 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!