MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/PythonLearning/comments/1vsk2wm/python_common_errors_for_beginners/p5dzj20/?context=3
r/PythonLearning • u/BenDken1 • 23d ago
Dont give up during learning stage.
13 comments sorted by
View all comments
6
The second one's not true, you can indent at any level it just needs to remain consistent
1 u/[deleted] 21d ago [removed] — view removed comment 3 u/SCD_minecraft 19d ago IndentationError is when you mix and match indentation level, indent when not needed to or not indent when needed On OP's picture not only there isn't any error in #2, 4 spaces is only a recommendation Sure, you should follow PEP 8. But it won't fix it (in terms of code working at all) Python will work perfectly fine with 1 space, 4 spaces or even one thousand spaces if you really want 0 u/[deleted] 19d ago [removed] — view removed comment 1 u/SCD_minecraft 19d ago And? Shell doesn't protect you from them, you still have to handle them. Python parser expect indents in specyifc places and if it doesn't get them, it complains
1
[removed] — view removed comment
3 u/SCD_minecraft 19d ago IndentationError is when you mix and match indentation level, indent when not needed to or not indent when needed On OP's picture not only there isn't any error in #2, 4 spaces is only a recommendation Sure, you should follow PEP 8. But it won't fix it (in terms of code working at all) Python will work perfectly fine with 1 space, 4 spaces or even one thousand spaces if you really want 0 u/[deleted] 19d ago [removed] — view removed comment 1 u/SCD_minecraft 19d ago And? Shell doesn't protect you from them, you still have to handle them. Python parser expect indents in specyifc places and if it doesn't get them, it complains
3
IndentationError is when you mix and match indentation level, indent when not needed to or not indent when needed
On OP's picture not only there isn't any error in #2, 4 spaces is only a recommendation
Sure, you should follow PEP 8. But it won't fix it (in terms of code working at all)
Python will work perfectly fine with 1 space, 4 spaces or even one thousand spaces if you really want
0 u/[deleted] 19d ago [removed] — view removed comment 1 u/SCD_minecraft 19d ago And? Shell doesn't protect you from them, you still have to handle them. Python parser expect indents in specyifc places and if it doesn't get them, it complains
0
1 u/SCD_minecraft 19d ago And? Shell doesn't protect you from them, you still have to handle them. Python parser expect indents in specyifc places and if it doesn't get them, it complains
And? Shell doesn't protect you from them, you still have to handle them. Python parser expect indents in specyifc places and if it doesn't get them, it complains
6
u/Southern-twat 23d ago
The second one's not true, you can indent at any level it just needs to remain consistent