Ask coding questions

← Back to all posts
I hate indentation errors, Ive tried everything
h
JULIODIAZ1 (50)

When I fix one indentation error, another pops up immediately, and yes, Ive tried changing all tabs to spaces but it dont work. Here is my code: https://replit.com/@HackersClan/Project-JARVIS-AI#main.py , work your magic replit community.

Answered by EmmaGao8 (33) [earned 5 cycles]
View Answer
Comments
hotnewtop
EmmaGao8 (33)

the mix of spaces and tabs is called a TabError. I been through one before and I hope my answer prevents you from going through another indentation errors.

JULIODIAZ1 (50)

Thank SMMMMMMMM! ive tried fixing it for hours then gave up @EmmaGao8

JULIODIAZ1 (50)

Is there anyway I can repay you?(other than cycles of course coz ive already marked your answer @EmmaGao8

EmmaGao8 (33)

A tip is to change your indentation to 4 spaces, delete all indents, and put tabs where they should be.

EmmaGao8 (33)

Hello! For some reason, your indents aren't equally spaced, ie. some indents are 2 and others are 4.

JULIODIAZ1 (50)

there is still an indentation error.... @EmmaGao8

EmmaGao8 (33)

@JULIODIAZ1 Delete one tab from the sleep line

EmmaGao8 (33)

@JULIODIAZ1 Just one from the line where the error occured

EmmaGao8 (33)

@JULIODIAZ1 There are quite a few lines where the use of tabs are inconsistent and some have one tab more

EmmaGao8 (33)

@JULIODIAZ1 Try find them yourself, you won'tlearn if i just tell you

EmmaGao8 (33)

@JULIODIAZ1 note that in the error, they specify the line on which the error occured

JULIODIAZ1 (50)

im aware and ive been trying to do it myself, why d you think I posted this in repl ask?

to
get
help

and telling me does help me learn, thats how most people function.
@EmmaGao8

JULIODIAZ1 (50)

oh, nevermind i see you forked it, i jsust ctrl c, ctrl v thx @EmmaGao8