1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aev [14]
3 years ago
14

Write a program that lists all ways people can line up for a photo (all permutations of a list of strings). The program will rea

d a list of one word names, then use a recursive method to create and output all possible orderings of those names, one ordering per line.
Computers and Technology
1 answer:
irinina [24]3 years ago
3 0

Answer:

Check the explanation

Explanation:

Executable Code:

def all_permutations(permList, nameList):

   # Define the function to create a list

   # of all the permutations.

   def createPermutationsList(nameList):

       # Compute and store the length of the list.

       n = len(nameList)

       # Return an empty list if the size is 0.

       if n == 0:

           return []

       # Return the element if the size is 1.

       if n == 1:

           return [nameList]

       # Create an empty list to store the permutations.

       permList = []

       # Start the loop to traverse the list.

       for i in range(n):

           # Store the first element of the current list.

           first = nameList[i]

           # Compute the store the remaining list.

           remaining = nameList[:i] + nameList[i+1:]

           # Start the loop and call the function recursively

           # with the remaining list.

           for perm in createPermutationsList(remaining):

               # Append the element in the permutation list.

               permList.append([first] + perm)

       # Return the permutation list.

       return permList

   # Call the function to compute the permutation list

   # and store the result.

   permList = createPermutationsList(nameList)

   # Start the loop to display the values.

   for perm in permList:

       for val in perm:

           print(val, end = " ")

       print()

# Call the main() function.

if __name__ == "__main__":

   # Prompt the user to enter the input.

   nameList = input().split(' ')

   permList = []

   # Call the function to create and output

   # the permutations of the list.

   all_permutations(permList, nameList)

#endcode

You might be interested in
The picture that graphically represents the items you use in windows is called a/an
rodikova [14]
The picture that graphically represents the times you use in windows is called an icon ( this is true for windows 7, assuming that was what you were referring to. I am not familiar with windows 8)
3 0
4 years ago
A digital clock on a small cooking appliance keeps time by?
IgorLugansk [536]
They typically use the 50-60 Hz oscillation of AC power or a 32,768 hertz Chrystal oscillator to keep time. <span />
5 0
3 years ago
Why does Microsoft release new versions of its Windows operating system every few years?
Korolek [52]
A to keep up with advances in computer capabilities
8 0
4 years ago
1. This are tools used to make any presentation interesting and exciting.
larisa [96]

Answer:

c. hyperlinks

Explanation:

The correct option is - c.hyperlinks

Reason -

The "hyperlink" function in PowerPoint allows users to advance from one slide to another slide in the presentation when they click on a predetermined word, shape, or image, thereby allowing for a more dynamic and interactive experience than can be obtained with serial presentation of slides alone.

4 0
3 years ago
Jabari is writing pseudocode for a new video game he wants to create. What should he include in his pseudocode?
erastova [34]

Answer:

The answer is "Option c".

Explanation:

The Pseudocode is a definition of actions in an algorithm or some other method of software engineering. It also uses regular programming language, formal conventions, and is associated with human learning rather than computer learning, and the wrong choice can be defined as follows:

  • In choice a, It is wrong because there are so many languages, and it is not easy to understand all.
  • In choice b, It is wrong because it is used for better understanding.
  • In choice d, it is wrong because words are also not only common to programmers.
5 0
3 years ago
Other questions:
  • When you “listen” to evaluate an online message, which question should you ask?
    11·1 answer
  • Which statement is true
    12·1 answer
  • What is an image that you can apply to another image to add detail and texture?
    6·1 answer
  • ................njkkjjiooiuuuu
    6·1 answer
  • Stella likes using social networking websites. Which Netiquette practice should Stella follow?
    9·2 answers
  • One out of how many people in the world has a Fac3book account?
    8·1 answer
  • What is different between attaching a file on an email program versus a smartphone?
    12·2 answers
  • What was originally called "shareware"
    9·2 answers
  • Write passage on computer virus​
    10·2 answers
  • The agency that started ARPANET was looking for
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!