I wanted to calculate the median I don’t know what is wrong here
UPDATE:
def median(a,b,c):
if a>b:
if b>c:
return b
else:
if a>c:
return c
else:
return a
else:
if b<c:
return b
else:
if a>c:
return a
else:
return c
My error is : File “prog.py”, line 4
return b
^
IndentationError: expected an indented block
Your indentation is wrong. Each
else:must line up with its correspondingif ...:, and each nested block must be indented.For example,
should read
Code that isn’t indented correctly isn’t valid Python.
P.S. The entire function can be rewritten as follows: