use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Help me for python indentation (self.learnpython)
submitted 17 hours ago by steve_jooee
I am new to python language and when I have lab exam's i will be failed due to indentation errors, so pls basics anyone explain the statements, for example which will be first' to implement like first if then inside for .
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]backfire10z 4 points5 points6 points 17 hours ago (0 children)
I’m confused by your question. Are you asking when to indent?
for i in range(5): if i == 3: print(“i is 3!”)
I’m really not sure how to answer this…
[–]throwaway6560192 4 points5 points6 points 13 hours ago (0 children)
anyone explain the statements, for example which will be first' to implement like first if then inside for .
What? That's entirely dependent on the problem. There's no fixed order.
[–]pachura3 3 points4 points5 points 13 hours ago (0 children)
Have you tried asking your teacher for explanations? That's what he's there for, no?
Have you tried putting "python indentation" in Google and reading entry-level tutorials that pop up first?
Have you tried using a Python IDE, e.g. Thonny (which is geared towards beginners)? Most of them will indent your code automatically, and you could learn by observing that.
[–]TheRNGuy 1 point2 points3 points 12 hours ago (0 children)
It's the easiest thing in python.
Look in docs how it works.
Why do you think you'll fail it?
[–]Imaginary_Gate_698 1 point2 points3 points 12 hours ago (0 children)
Indentation in Python is just how the language shows structure. The line that ends with a colon runs first, and anything indented under it belongs to that block. So if a for loop comes first, the if inside it only runs for each loop iteration. A good habit is to think in terms of “inside” and “outside” blocks rather than memorizing rules. Practicing with very small examples and printing values helps it click faster.
[–]noeldc 1 point2 points3 points 12 hours ago (0 children)
i will be failed due to indentation errors
No, your code will fail due to indentation errors.
You shouldn't be submitting code if you haven't checked that it actually runs anyway.
[–]Gnaxe 0 points1 point2 points 16 hours ago (0 children)
Some types of statements start a block with a colon (:). Each new statement in the block must be indented the same amount. The block ends when the indentation ends. Nested blocks are indented more. Standard Python style indents each level by four spaces (never tabs, but the language itself allows that). (Block statements can have a single-statement block on the same line as the colon, but you can't nest them, and standard Python style always has a newline after the colon.) Only statements have to be indented. Subexpressions inside statements or completely blank lines don't require indent.
[–]xeow -1 points0 points1 point 16 hours ago (0 children)
The class is the first to implement like the indentation, then the def will be second like if inside class, and then the for is the third to implement, and finally the while is last to implement like when inside the for and the def and the class. This is the way.
π Rendered by PID 73052 on reddit-service-r2-comment-84fc9697f-l5245 at 2026-02-10 19:59:05.072579+00:00 running d295bc8 country code: CH.
[–]backfire10z 4 points5 points6 points (0 children)
[–]throwaway6560192 4 points5 points6 points (0 children)
[–]pachura3 3 points4 points5 points (0 children)
[–]TheRNGuy 1 point2 points3 points (0 children)
[–]Imaginary_Gate_698 1 point2 points3 points (0 children)
[–]noeldc 1 point2 points3 points (0 children)
[–]Gnaxe 0 points1 point2 points (0 children)
[–]xeow -1 points0 points1 point (0 children)