Sonu
Sonu

Reputation: 3

Python code written on Ubuntu, with inconsistent tab space

i'm a beginner, and i have just started using python on ubuntu. the code given below has been edited twice to weed out the indentation errors, but the same error persists.

 try: 
        f = int(data['value']) 
        print (f)
        if f > max or f < min:
            response =print("done!") 
    except Exception as e: 
        print ("Error",e)

it says that the error is in the if statement and the error is "inconsistent use of tabs and spaces in indentation"

Upvotes: 0

Views: 239

Answers (1)

M.K
M.K

Reputation: 1495

Well, the exceptshould be at the same "height" or level as the try. You also had an extra indentation on the try sector! Remember, python works with indentation only, no {}are used!

try: 
    f = int(data['value']) 
    print (f)
    if f > max or f < min:
        response =print("done!") 
except Exception as e: 
    print ("Error",e)

Upvotes: 2

Related Questions