0
if
If 1 + 1 == 2: If 2 * 2 == 8: Print ("if") Else: Print ("else") So the correct answer (according to sololearn and others) is else. But when I try to prove it, by putting the exact code into Code Playground it gives no output. Why is that? Can anyone explain it? Wow! I'm such a dummy! OK, now it works in Code Playground lol. Sorry I didn't answer Rafik, but i couldn't see your answer for some reason. I'm happy now I've proved to myself that it works :)
4 Answers
+ 2
else
+ 1
else
+ 1
# That's why indentation in Python is important:
if 1 + 1 == 2:
if 2 * 2 == 8:
print ("if")
else:
print ("else")
# will result in no output, but:
if 1 + 1 == 2:
if 2 * 2 == 8:
print ("if")
else:
print ("else")
# will output 'else' (as expected, contraly to the first one quoted in your question)...
# Anyway, be carreful of keywords case: 'print' is not 'Print', 'else' not 'Else', and so on ;)
0
else