New course! Every coder should learn Generative AI!
Try a free lesson+ 1
I don't understand what is the error in this project help me??
13 Answers
+ 2
Pay attention to indentation
Correct code is
x = 6
if x == 8:
print("X is 8")
else:
if x == 7:
print("X is 7")
else:
if x == 10:
print("X is 10")
else :
print("X is not 8 and 7 and 10")
+ 6
Always pay attention to identation, here is how to properly ident your code, and more tips, by HonFu:
https://code.sololearn.com/c9a0cG9dpVUr/?ref=app
+ 5
Aymane Boukrouh, thanks for showing that one!
I have another one, maybe better for the beginning (just read it, don't run):
EDIT: What is this? I can't link codes! New bug?
Going over a side track now:
https://code.sololearn.com/cT5BRIbkia21/?ref=app
+ 2
Don't worry only indentation is the problem
+ 1
Thanks honfu
+ 1
I was really confused about this rules
+ 1
Don't worry, itwill become second nature to you if you practice for a while.
+ 1
I understand now
+ 1
In python you also have 'elif'. Then you don't need to wander a step to the right each time.
That would look like this:
x = 6
if x == 5 :
print("X is five")
elif x == 4 :
print("X is four")
elif x == 7 :
print("X is seven")
else:
print("X is not five,four and seven")
+ 1
Oh. I just learn this
Elif is a short word of "else if"
+ 1
Yeah thanks
+ 1
You need to indent it