Having Indentation Error but I'm clueless why?

def apply_discount (price,discount):

    if isinstance(price,int) or isinstance(price,float):

        

        if isinstance(discount,int) or isinstance(discount,float):            

        

        else:

        

            print(The discount should be a number)

    else:

        print("The price should be a number")



Error:
def apply_discount (price,discount):

if isinstance(price,int) or isinstance(price,float):

    

    if isinstance(discount,int) or isinstance(discount,float):            

    

    else:

    

        print(The discount should be a number)

else:

    print("The price should be a number")

Error Correction:
Traceback (most recent call last):
File “main.py”, line 6
else:
^^^^
IndentationError: expected an indented block after ‘if’ statement on line 4

You just need to write some code inside your if statement. You can use pass as a placeholder until you’re ready.

1 Like