What's wrong with my python code?

x = 4 + 5
if x == 9 {
print (‘you are correct’)
}
else {
print(‘die’)
}

That’s not python, but other than that no idea - you’d have to explain what you are trying to make happen, what’s happening instead, and also take care that the code is intact in your post so that others see the same thing as what you’re trying to run

3 Likes

The code should be
if x == 9:
print (‘you are correct’)
else:
print(‘die’)

Python indent is painful but that’s the reality

2 Likes

Like @ionatan pointed out, that’s not Python.

Please tell us:
The expected output/what should happen
The actual output
The language you’re trying to write in

With this information, we should be able to help.

2 Likes

just to test whether the compiler was working. I tried the code

it is to see the if loop in python as i have never used python

That is not valid python syntax you are using, if you hadn’t told us it was python, i doubt we could have figured it out.

1 Like

An if statement in Python (specifically 3.x) looks like this:

x = 4 + 5
if x == 9:
    print("Correct")
else:
    print("Incorrect")
3 Likes