##### programming help (python, very urgent!!!)

hello, all those out there, I need some help with this question that I need to solve right now.

this is the problem:

x +2y = z; x = 20, z = 36. Write a program to find the value of y, by replacing (looping) integer values from 1 to 100 for y. When the left side equals the right side of the equation, print the value of Z.

can anyone give me the answer or part of the answer to this?

thx.

**Voters**

Do you get it? If you need any further help, always feel free to ask!

Ok, I'll help you!

@CodingElf66

thank you so much!

@KrisLee4 No problem!

@KrisLee4 I'll be glad to help if you need it, always feel welcome!

hi @CodingElf66,

i just did as you advised but got this:

File "main.py", line 3

x+2y = z

^

SyntaxError: invalid syntax

what should i do?

thx

@KrisLee4 Oh yeah, Python doesn't allow you to do that. Sorry, I forgot.

It is:

The `*`

is multiply in Python, if we do that we get an SyntaxError.

I'll try to explain this step by step. So, when you declare the expression that:

`x + 2y = z`

`x = 20`

`z = 36`

We can substitute the variables in to the equation. So, our equation would now be:

`20 + 2y = 36`

You want to use a loop (for loop) to find the value of

`y`

. So, you can do the code below:First, we use the information you gave to substitute into the equation. Then, we use a for loop to find every value of

`y`

from 1 to 100 (101-1, that's how for loops work). We then use a if statement inside to see if the equation is true or not. The else after the if statement is to see if the for loop wasn't breaked. We then print what we solved!wait, after the print in the if statement you should add a

`break`

so that the else does not get triggered. @CodingElf66@Whippingdot Sorry forgot it, I forgot it. Lol

@Whippingdot There you go, I just updated it.

kk @CodingElf66