dimanche 26 novembre 2017

how to check if variables equal each other

I am trying to check if two variables are equal to each other. If they are, I want to reset a variable and change another. Here is my sample code:

eq = int(input("\nhow many equations do you have? "))
matrix = [[] for _ in range(eq)]
solution = [[] for _ in range(eq)]
for i in range(eq*eq):
    q = 0
    x = 0
    a = int(input("input the coefficients to your variables in your equation: "))
    matrix[x].append(a)
    q += 1
    if q == eq:
        q = 0
        print("It's time to move on to the next equation!")
        x += 1

The problem is the if statement. Everything else works fine.

Aucun commentaire:

Enregistrer un commentaire