0
var1 = 6
var2 = 56
var3 = int(input())
if var3>var2:
print("Greater")
elif var3==var2:
print("Equal")`
else:
print("Lesser")

I am getting an indentation error. Why is this?

CrazyChucky
  • 3,263
  • 4
  • 11
  • 25
  • Your `if/elif/else` statements all have to be at the exact same level of indentation, but they aren't. One of them has too few spaces. – John Gordon Jan 22 '22 at 16:05
  • 1
    @JohnGordon As shown, nothing's indented at all, by any number of spaces, which would throw `IndentationError: expected an indented block`. – CrazyChucky Jan 22 '22 at 16:06
  • @CrazyChucky That is not the reported error, so this is not the actual code. I based my comment on what the code must be, given the error message. – John Gordon Jan 22 '22 at 16:52
  • @JohnGordon Good point; my apologies for lack of clarity. What I meant to call attention to is that because the code shown differs from the error, we can't really be certain at all about the original cause, other than it's something to do with indentation levels. It might not even be this location in the code, for all we know—especially since that error couldn't happen at line 7 of what's shown. (That's why I flagged it as a dupe to the canonical whose top answer includes a comprehensive coverage of Python indentation, all the errors relating to it, and how to fix them.) – CrazyChucky Jan 22 '22 at 16:54

2 Answers2

0
var2 = 56
var3 = int(input())
if var3>var2:
    print("Greater")
elif var3==var2:
    print("Equal")`
else:
    print("Lesser")
-1
var2 = 56
var3 = int(input())
if var3>var2:
    print("Greater")
elif var3==var2:
    print("Equal")
else:
    print("Lesser")

or if it a problem with the IDE you are using i.e not able to auto-indent please consider installing python code formatter.

Shedrack
  • 656
  • 7
  • 22