Implement the function permutations() that takes a list lst as input and returns a list of all permutations of lst (so the returned value is a list of lists). Do this recursively as follows: If the input list lst is of size 1 or 0, just return a list containing list lst. Otherwise, make a recursive call on the sublist l[1:] to obtain the list of all permutations of all elements of lst except the first element l[0]. Then, for each such permutation (i.e., list) perm, generate permutations of lst by inserting lst[0] into all possible positions of perm.

>>> permutations([1, 2])

[[1, 2], [2, 1]]

>>> permutations([1, 2, 3])

[[1, 2, 3], [2, 1, 3], [2, 3, 1], [1, 3, 2], [3, 1, 2], [3, 2, 1]]

>>> permutations([1, 2, 3, 4])

[[1, 2, 3, 4], [2, 1, 3, 4], [2, 3, 1, 4], [2, 3, 4, 1],

[1, 3, 2, 4], [3, 1, 2, 4], [3, 2, 1, 4], [3, 2, 4, 1],

[1, 3, 4, 2], [3, 1, 4, 2], [3, 4, 1, 2], [3, 4, 2, 1],

[1, 2, 4, 3], [2, 1, 4, 3], [2, 4, 1, 3], [2, 4, 3, 1],

[1, 4, 2, 3], [4, 1, 2, 3], [4, 2, 1, 3], [4, 2, 3, 1],

[1, 4, 3, 2], [4, 1, 3, 2], [4, 3, 1, 2], [4, 3, 2, 1]]

Answers

Answer 1

Answer:

def permutations(myList: list)-> list:  

   if len(myList) <= 1:  

       return [myList]  

   perm = []  

   for i in range(len(myList)):  

      item = myList[i]  

      seglists = myList[:i] + myList[i+1:]  

      for num in permutations(seglists):  

          perm.append([item] + num)  

   return perm

 

data = [1,2,3]  

result = permutations(data)  

print(result)

Explanation:

The program defines a python function that returns the list of permutations. The program checks if the length of the input list is less than or equal to one. The function declaration identifies the input and output as lists.

The for loop iterate through the list and the permutations are saved in an empty list in the next loop statement. At the end of the program, the list of lists is returned.


Related Questions

If columns are labelled alphabetically, what will be the label for the cell in row 1, column 16,384?

Answers

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Hope this helps!

Have you ever tried using such a camera?​

Answers

Answer: yeah i mean i use my canon camera

Explanation:

Write a python program that gets a number using keyboard input. If the number is positive, the program should call countdown

Answers

Answer:

def countdown():

 print("This is countdown")

number = int(input("Enter number: "))

if (number > 0):

 countdown()

Explanation:

This is literally what you asked, but what is the purpose?

Select the correct answer.

The idea that different aspects of health influence each other is known as _____ .

A.

Holistic health

B.

Happy health

C.

Integral health

D.

Perfect health

Answers

Answer:

A.  Holistic health

Explanation:

Holistic health refers to the method of caring the entire body. It includes physical, mental and emotional health of the individual. The overall health of an individual depends on the fitness of al these aspects of the body. The mind, body and the soul are considered to be interdependent and therefore the fitness of the body depends on the fitness of all of these parts.

Answer:

A

Explanation:

The definition of holistic is relating to the idea that things should be studied as a whole and not just as a sum of their parts. An example of holistic is health care that focuses on the health of the entire body and mind and not just parts of the body.

Advantages of special purpose computer

Answers

Answer:

The main advantage of the special-purpose systems is the possibility to utilize a much higher fraction of available silicon to actually do calculations. ... All the rest of the calculation, such as the time integration of the orbits of particles, I/O, and diagnostics are handled by a general-purpose host computer..

Explanation:

Which artistic technique uses multiple layers of small calligraphic or scribbled marks?
A. random hatching
B. crosshatching
C. shading
D. stippling
E. scrumbling

Answers

I would go with C.shading. It just makes the most sense

Answer:

E. scrumbling

Explanation:

What are the inputs and outputs of the app "Spotify"?

Answers

Hey the I/O for Spotify would be. for I or input keyboard and mouse.

and for O or output the sound files being sent from the server to the pc

Hope this helps.

-Toby  aka scav

Answer:

Input is for mics and other tools, output is your audio interface, speakers, headphones, so on. 3. At the top you'll find general system-wide settings, below you find dedicated settings for each open app. You'll need to have Spotify open to see it there.

Explanation:

Given the following table of students, assignments, and grades for a single class:

Student_ID

Student_Name

Assignment_1_Date

Assignment_1_Name

Assignment_1_Grade

Assignment_2_Date

Assignment_2_Name

Assignment_2_Grade

Assignment_3_Date

Assignment_3_Name

Assignment_3_Grade

1011

Susan J. Smith

2015-06-01

Homework - Chapter Seven

76

2015-06-05

Chapter 7 Quiz

88

2015-06-12

Homework – Chapter 8

A

2332

Jones, Jamal K.

2015-06-01

Homework - Chapter Seven

84

2015-06-05

Quiz – Chapter 7

89

2015-06-12

Homework – Chapter 8

95

3432

Brown, Ronald

2015-06-01

Homework - Chapter Seven

66

2015-06-05

Quiz – Chapter 7

78

2015-06-12

Homework – Chapter 8

B

5435

Killen, Katie

2015-06-01

Homework - Chapter Seven

97

2015-06-05

Chapter 7 – Quiz

95

2015-06-12

Homework – Chapter 8

94

7574

Powell, B.

2015-06-01

Homework - Chapter Seven

68

2015-06-05

Quiz – Chapter 7

89

9677

Pat Hayes

6/1/2015

Homework - Chapter Seven

89

2015-06-05

Quiz – Chapter 7

85

2015-06-12

Homework – Chapter 8

99

Examine the data in the table above and identify any columns that contain data inconsistencies. Place an X in the Consistent or Inconsistent column.

Answers

Answer:

i need more

Explanation:

i need more

The objective of this task is to use Scapy to estimate the distance, in terms of number of routers, between your VM and a selected destination. This is basically what is implemented by the traceroute tool. In this task, we will write our own tool. The idea is quite straightforward: just send a packet (any type) to the destination, with its Time-To-Live (TTL) field set to 1 first. This packet will be dropped by the first router, which will send us an ICMP error message, telling us that the time-to-live has exceeded. That is how we
This project is based on SEED labs by Wenliang Du, Syracuse University.
get the IP address of the first router. We then increase our TTL field to 2, send out another packet, and get the IP address of the second router. We will repeat this procedure until our packet finally reach the destination. It should be noted that this experiment only gets an estimated result, because in theory, not all these packets take the same route (but in practice, they may within a short period of time). The code in the following shows one round in the procedure
a = IP()
a.dst '1.2.3.4
a.ttl = 3
b = ICMP()
send (a/b)
If you are an experienced Python programmer, you can write your tool to perform the entire procedure automatically. If you are new to Python programming, you can do it by manually changing the TTL field in each round, and record the IP address based on your observation from Wireshark. Either way is acceptable, as long as you get the result
Task: Sniffing and-then Spoofing
In this task, you will combine the sniffing and spoofing techniques to implement the following sniff- and-then-spoof program. You need two VMs on the same LAN. From VM A, you ping an IP X. This will generate an ICMP echo request packet. If X is alive, the ping program will receive an echo reply, and print out the response. Your sniff-and-then-spoof program runs on VM B, which monitors the LAN through packet sniffing. Whenever it sees an ICMP echo request, regardless of what the target IP address is, your program should immediately send out an echo reply using the packet spoofing technique. Therefore, regard-less of whether machine X is alive or not, the ping program will always receive a reply, indicating that X is alive. You need to use Scapy to do this task. In your report, you need to provide evidence to demonstrate that your technique works.

Answers

Answer:

kad ;ikajlfhdakjsfhadskfadhkjfahdjkfadk a jk h

Explanation:

Answer:

is this even a legit question



Combination of one or more columns used to identify particular rows in a relation is a (n)

Answers

Answer:

Combination of one or more columns used to identify particular rows in a relation is a key

A key is a combination of one or more columns that is used to identify particular rows in a relation.

KEYS in DBMS (database management system) is an attribute or set of attributes which helps you to identify a row in a relation(table). They allow you to find the relation between two tables.

Keys help you uniquely identify a row in a table by a combination of one or more columns in that table. Key is also helpful for finding unique record or row from the table.

Database key is also helpful for finding unique record or row from the table.

Find out more on DBMS at: https://brainly.in/question/1919695

6n^3+n-2 C++ code using Dev
i need only the code

Answers

Answer:

A = 6*pow(n,3) +n - 2

Explanation:

I'm not sure if this what you need but that's what I can help you with :)

Add (11011)2 + (111)2​

Answers

Answer:

(11011)2+(111)2=(100010)2

hope it helps.

Answer:

(100010)square is the correct answer Hope it helps you have a great day keep smiling be happy stay safe ☺

what, if anything, is returned by the method call rearrange ("apple")?

Answers

Answer:

[tex] \boxed{E} \to \boxed{nothing \: is \: returned \: due \: to \: run \: tie \: error}[/tex]

A Zookeeper wants you to create a program to keep track of all of the animals in the zoo and people working for him. You are given 4 files: Mammals.txt, Birds.txt, Reptiles.txt, and Personnel.txt. Your task is to create an array of structs for each file to hold the entries. The first line of each file will be a number indicating how many entries are in the file.

Answers

Answer:

I don't know  you should figure that out good luck

Explanation:

good luck

Which term describes the surrounding area of this image?

The surrounding area of this image is called
Surroundings
Foreground
Background

This area is also called a
Negative
Positive
Neutral

Answers

Answer: background/negative

Explanation: the background, is negative space. A solid piece of sculpture occupies space, and makes the space around it come to life.

2. BIOS is contained in ROM and not in RAM. Can you guess why?​

Answers

Answer:

Because RAM is only used for short term storage (and doesn't contain anything that will need to be accessed often) RAM it loses its contents when turned off. So when you power on a computer, it has to start running bootup code which has to be stored in ROM

Under foreign corrupt practices act, under what conditions is a bribe not unlawful explain and provide an example

Answers

Answer:

ex. telling your children if you clean up you get new toys

When you use a rest area, you should:
A. Make sure your windows are closed tightly
B. Stop in a dark place where you can sleep
C. Walk around your car after resting
D. Sleep with the windows rolled down

Answers

The answer would be A.
The rest seem impractical.
The answer is A because you need to make sure you’re safe before resting

Which statement is true for slide or positive film?
A.
Slides or positive films give low color saturation and contrast.
B.
Slides or positive films give high quality pictures with higher color saturation and contrast.
C.
Slide or positive films cannot be used to digitize and scan pictures.
D.
Slide or positive films are useful for cheaper compact cameras.

Answers

Answer:

B.

Slides or positive films give high quality pictures with higher color saturation and contrast.

Explanation:

The above is true for slides with positive film. This is because, the positive film happens to have a high resolution when it was been used thereby giving out a high quality video at the end of the recording. The higher colour saturation and contrast are also an attribute of a slide  or positive film.

Answer:

B

Explanation:

which among the following if absent, a computer is not complete.
A. mouse
B. DVD
C. user
D. projector

Answers

i think mouse is the correct answer

Answer:

user because all the other things the computer need

where are all of your documents saved?

Answers

Answer:

create a my document folder so you can easily find it

A data science experiment you are conducting has retrieved two historical observations for the price of Bitcoin(BTC) on December 2, 2017 of 11234 and 12475. Create a Python script that stores these two historicalobservations in a list variable namedbtcdec1.Your data science experiment requires four additional data tasks. The first task is to use the listappend()method to add the BTC price of 14560 to the listbtcdec1. The second task is to create a new empty listnamedbtcdec2and append the BTC prices of 15630, 12475, and 14972. The third task required you to usethe listextend()method to add the contents ofbtcdec2into the listbtcdec1. The fourth and final taskrequires you to use the listsort()method of the listbtcdec1to sort the items in the newly extended list,then use theprintstatement to output the content of listbtcdec1to the Python console.Starter code:_______.

Answers

Answer:

Following are the code to this question:

btcdec1=[11234, 12475] #defining a list btcdec1 that holds two integer values  

btcdec1.append(14560)#using append method to add value in btcdec1 list

btcdec2=[]#defining an empty list btcdec2

btcdec2.append(15630)#using append method to add value in btcdec2 list

btcdec2.append(12475)#using append method to add value in btcdec2 list

btcdec2.append(14972)#using append method to add value in btcdec2 list

btcdec1.extend(btcdec2)#using the extend method to add value list into btcdec1

btcdec1.sort()#using sort method to arrange value in ascending order

print(btcdec1)#print list btcdec1

Output:

[11234, 12475, 12475, 14560, 14972, 15630]

Explanation:

In this code a list "btcdec1" is declared, which holds two integer variables, in the next step, it uses the append method to add another element into the list.

In the next step, another empty list "btcdec2" is declared, which uses the append method to hold the integer element, and uses the extend and sort method to add the second list into the first one and then sort the whole list and print its values.  

A company utilizes a specific design methodology in the software design process. They utilize concepts of encapsulation in design. Which design
methodology would they be using?
A
structured design
B.
modular design
C.
object-oriented design
rapid application development
D
E
use-case design

Answers

Answer:

C. object-oriented design

Explanation:

Answer:

c. object- oriented design.

Explanation:

i took the test.

You work at a computer repair store. A customer wants you to install a new sound card into his computer to run his home theater system. Currently, the computer uses the sound card built into the motherboard. You need to upgrade the computer with a better sound card that installs into an expansion card slot. Your task is to complete the following:

a. Install the sound card with the optical output.
b. View the Details for each card to identify the card with an optical audio connector.
c. Boot into the BIOS and disable the onboard sound card.
d. Boot into Windows and verify that the new sound card is recognized and the onboard sound card does not appear in Device Manager.

Answers

Answer:

Explanation:

The following tasks are needed to complete the installation of the sound card so that it is fully usable.

a. and b. : First, you need to slot the sound card into a pci-e slot in the motherboard and connect the optical cable to the back of the sound card. You can look at the back of the card or the box to see if it has an optical audio connector slot.

c. Next you can boot into the Bios to disable the onboard sound card. Each motherboard is different but the usual way of entering the bios is pressing F12 when turning on the PC. Then navigate to the motherboard options tab/menu and turn off the onboard sound.

d. Finally, turn on the PC, log in and at the bottom left search bar type in Device Manager. Next navigate to sound, video and game controllers and make sure the new sound card is being detected.

1. What characteristics are common among operating systems? List types of operating systems, and
examples of each. How does the device affect the functionality of an operating system?

Answers

The fundamental software applications running upon that hardware allow unauthorized to the interface so much with the equipment because then instructions may be sent and result obtained.

Some characteristics of OS are provided below:

Developers provide technology that could be suitable, mismatched, or otherwise completely at odds with several other OS categories throughout various versions of the same similar OS.Throughout two different versions, the OS's are often 32 as well as 64-Bit.

Type of OS:

Distributed OS.Time-sharing OS.Batch OS.

Learn more about the operating system here:

https://brainly.com/question/2126669

1. In what ways a computer system is like a human being
la
2. In what ways is it not like a human being
3. What will happen if the computer is not invented​

Answers

a computer system can be considered similar to human beings in a way that it needed various parts in order to it to function it humans we need the or such as hurt brain veins exactra while computer need the CPU Ram etc

This component of the CPU is responsible for fetching the data, converting it, and de-converting
A) ALU
B) RAM
C) Control Unit
D) None of the above

Answers

Answer : C.Control Unit

Reason

In CPU there are two components name ALU and CU(Control unit) which ALU's function is to solve mathematic sequence and CU fuction is to vetch data to memory and manage commands and input & output.

#See pic for how the data proceed

1. Which of the following is used to operate computers and execute tasks?
A. Software
C. Update
B. Application
D. Upgrade

Answers

I wish I could get the new app to play this app and it is great for the iPad version

Answer:

a.software

I hope it hel

name 20 input device​

Answers

Answer:

I wish that is helpful

.........

Answer:

Some Input devices are;

KeyboardMouseLight penMicrophoneDocument scannerCharacter readerBar-Code readerTrack pointTouch padTrack ballDigital cameraMagnetic Ink Character readerMagnetic stripTouch screen

Use the five-step decision-making process discussed in Chapter 1 to analyze the following situations and recommend a course of action.

You are a new salesperson at a large software manufacturing firm. It is three weeks from the end of the sales quarter and you and your sales manager are sitting pretty—you have both already met your sales quota for the quarter. In addition, you just closed another deal with a new customer for $100,000 of software and customer service. This order would put you way over your sales quota for the current quarter. Your manager suggests that you hold this new order so it gets recorded against next quarter. She explains that because sales during the next three months tend to slow down, salespeople frequently miss their quotas and associated sales bonuses for that quarter. Holding this large order to next quarter would help you get an excellent start and almost guarantee that you meet your quota. What would you do?

Answers

Answer:

The responses to this question can be defined as follows:

Explanation:

Yeah, their numerous sponsorships brands have potential. Every business does have its Trademarks for a commodity, that distinguishes others. It's an infringement for trademarks, it has only provided to those trivialities, which success and if I would plan this for my friend. I would never list or show those points of his accomplishments I never would Numerous sponsors. This should include all its information using its trademarks as well as other Site partners are excluded even though they are or are browsing their trademarks where the law is prohibited.

Other Questions
Which of the following is an example of a spontaneous conversation?OA child asking a question as they're getting ready for bedO Parents doing a daily school agenda checkOA parent and teen having a serious conversationO A family discussing a challenging and difficult topic he function f has a continuous derivative. if f(0)=1, f(2)=5, and 20f(x)x=7, what is 20xf(x)x ? (A) (B) (C) 10 (D) 17 Bracey Company manufactures and sells one product. The following information pertains to the companys first year of operations:Variable cost per unit: Direct materials $ 34Fixed costs per year: Direct labor $ 495,000Fixed manufacturing overhead $ 453,750Fixed selling and administrative expenses $ 78,000The company does not incur any variable manufacturing overhead costs or variable selling and administrative expenses. During its first year of operations, Bracey produced 27,500 units and sold 25,100 units. The selling price of the companys product is $75 per unit.Required:1. Assume the company uses super-variable costing:a. Compute the unit product cost for the year.b. Prepare an income statement for the year. Drawing a right side up triangle Write a recursive function called Draw Triangle that outputs lines or to form a right side up isosceles triangle Function Draw Triangle has one parameter, an integer representing the base length of the triangle. Assume the base length is always odd and less than 20. Output spaces before the first on the first line for correct formatting Hint. The number of increases by 2 for every line drawn Suppose f is increasing on the interval [a, b] and we want to estimate the area under the curve on this interval. 1. If f is concave down on this interval, using left endpoints would give how do the arboreal hypothesis and the visual predation hypothesis differ from each other? 4.2. use the fourier transform analysis equation (4.9) to calculate the fourier transforms of: (a) b(t 1) b(t- 1) (b) fr{u( -2- t) u(t- 2)} (1 point) find parametric equations for the sphere centered at the origin and with radius 4. use the parameters s and t in your answer. cheg a radioactive isotope initially has an activity of 400,000 bq. two days after the sample is collected, its activity is observed to be 170,000 bq. what is the half-life of this isotope? A toy manufacturer makes its own wind-up motors, which are then put into its toys. While the toy manufacturing process is continuous, the motors are intermittent flow. Data on the manufacture of the motors appears below.Annual demand = 75,000 unitsDaily sub-assembly production rate = 625Setup cost (S) = $85 per batchOperating days = 250Carrying cost = 16% per unit per yearUnit Cost = $63.95a. To minimize cost, how large should each batch of sub-assemblies be? [ Select ] ["7289.00", "1166.19", "1389.50", "1548.01", "1166.75"]b. What is the maximum production inventory [ Select ] ["789.45", "804.96", "2915.35", "5831.01", "686.27"]c. What is the total cost to manage the inventory? $ [ Select ] ["$7,288.00", "$8,236.39", "$583.15", "$2,915.50", "$4,118.20"]d. What are the number of set-ups in the process? [ Select ] ["3.44", "52.67", "6.86", "48.45", "23.89"]e. What if the toy manufacturer decided to make 1300 motors per batch, what would the set-up cost be? [ Select ] ["$4,118.20", "$4,903.85", "$1,166.27", "$5,830.90", "$2,915.40"]f. Based on the initial POQ, what percentage of time will the toy manufacturer be producing motors? [ Select ] ["52%", "80%", "20%", "35%", "48%"] A 2.26 L balloon of helium is at 30C and 1.61 atm, what happens to the pressure if the volume is increased to 4.12 L? A. There is not enough information to answer this question. B. The pressure doesn't change. C. The pressure increases. D. The pressure decreases. The cost of packing a box of chocolates is given by 1/4 x^2, where x is the number of chocolates (a box can never have fewer than 3 chocolates). If the weight of a box ofchocolates is given by x + 2, what is the cost of packaging per weight unit how muscle cell use oxygen? (a) Write an equation that represents the autoionization of water, including all phase labels. (b) What is the hydroxide ion concentration in a solution that contains hydronium ion at a concentration of 2.8 x 10^-6 M? organize the reactions from chs 11,14. analyze each of those reactions and try to assign them to a substitution, elimination, or oxidation category Which belief was included in the Declaration of Independence? Approximate Lake Superior by a circle of radius 162 km at a latitude of 47. Assume the water is at rest with respect to Earth and find the depth that the center is depressed with respect to the shore due to the centrifugal force. question 2 options: if random variable x has a binomial distribution with n=15 and p(success) =p= 0.6, find the mean of x. that is, find e(x). round to the whole number. do not use decimals. answer: 1. can you identify the new synthesized compounds by melting point? why? given the number of moles of Pb2+ and Cl- in the final solution in step 5, and the volume of that solution, calculate [pb2+] and [Cl-] in that solution