PROBLEM:- CODE IN PYTHON.. 8.8 LAB: All permutations of names Write a program that lists all ways people can line up for

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

PROBLEM:- CODE IN PYTHON.. 8.8 LAB: All permutations of names Write a program that lists all ways people can line up for

Post by answerhappygod »

PROBLEM:-
CODE IN PYTHON..
8.8 LAB: All permutations of names
Write a program that lists all ways people can line upfor a photo (all permutations of a list of strings). The programwill read a list of one-word names, then use a recursive functionto create and output all possible orderings of those namesseparated by a comma, one ordering per line.
When the input is:
then the output is (must match the belowordering):
THIS IS THE PROMPT I HAVE
def print_all_permutations(permList, nameList):# TODO: Implement method to create and output all permutations ofthe list of names.
if __name__ == "__main__":nameList = input().split(' ')permList = []print_all_permutations(permList, nameList)
.
ANSWER:-
BUT THIS MY OUTPUT
['Julia', 'Lucas', 'Mia']
['Julia', 'Mia', 'Lucas']
['Lucas', 'Julia', 'Mia']
['Lucas', 'Mia', 'Julia']
['Mia', 'Julia', 'Lucas']
['Mia', 'Lucas', 'Julia']
I DON'T WANT IT TO OUTPUT AS A LIST WITH COMMAS BUTINDIVIDUALLY AS A THREE.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply