The following is an algorithm nQueens that takes as input a listpartialSolution and a positive integer n, the dimension of the n×nchessboard, and for prints all solutions to the n-Queens problemusing backtracking. Function nQueens(partialSolution, n) {positions = getPositions(partialSolution, n) If positions is empty{ If length(partialSolution) ==n { print(partialSolution) } } Else{ For each element in positions { push(element, partialSolution)nQueens(partialSolution, n) pop(partialSolution) } } }
Write a program in Python that takes as input a positive integern and prints all possible solutions to the n-Queens problem. Yourprogram should use backtracking.
For example, your program may output: Enter value for n: 4Solutions ———— [1,
PayPal Gateway not configured
PayPal Gateway not configured