I am attempting to create a program to solve a specific system of equations using brute force with python. I solved for one equation and substituted it into the second equation. Variables a through f are given by user input, and I am trying to output values for x and y within a range of -10 to 10 if they exist. Any help is greatly appreciated, Thank You!
My problem is that for each check within the range the output is no solution, whereas I would like it to output no solution only if none of the numbers within the range satisfy the equation. Updated the code to fix the int object not callable error.
To be clear, the code is mostly working and gives the correct answer, but the answer is nested in roughly 100 'no solution' statements
''' Read in first equation, ax + by = c '''
a = int(input())
b = int(input())
c = int(input())
''' Read in second equation, dx + ey = f '''
d = int(input())
e = int(input())
f = int(input())
for x in range(-10, 10, 1):
for y in range(-10, 10, 1):
if a * x + b * y == c and d * x + e * y == f:
print(x, y)
else:
print('No solution')
# a * x + b * y = c
# d * x + e * y = f