python – How to generate all possibilities of adding + and – between numbers of a vector so the sum should be positive, using backtracking

I have to make a python application that generates all possibilities of adding + and – between numbers of a vector so the sum should be positive, using backtracking. I’m writing here because I don’t quite understand how to make that. As input, my application gets a vector of integer numbers: a1, a2, … an.…

Details

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.0.RELEASE

I don’t understand the reason why I’m getting such an error in my new project, mvn spring-boot:run I get this error when I execute the command Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.0.RELEASE:run (default-cli) on project spring5webapp: An exception occurred while running. null pom.xml <?xml version=”1.0″ encoding=”UTF-8″?> <project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”> <modelVersion>4.0.0</modelVersion> <groupId>guru.springframework</groupId> <artifactId>spring5webapp</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging>…

Details

Create a list in list comprehension and then create another list from that list inside the same list comprehension

That title is a mouthful, so it may be easier to show what I am trying to achieve via code. import pandas as pd data = [] for i in range(0,6): row = [] for j in range(0,6): if i == j: row.append(1) else: row.append(0) data.append(row) colnames = [(1,2),(1,3),(1,4),(2,1),(3,1),(4,1)] df = pd.DataFrame(data, columns = colnames)…

Details