What's wrong with my python code?


#1

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


#2

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

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

Python indent is painful but that’s the reality


#4

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.


#5

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


#6

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


#7

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.


#8

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

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