#π Constant Indent error
25 messages Β· Page 1 of 1 (latest)
@kind harbor
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
here is the code in text: if text_choice == 1:
sentences = []
for paragraph in data:
paragraph_sentences = [s.strip() for s in paragraph.split(".") if len(s.strip()) > 5]
sentences.extend(paragraph_sentences)
print(f"Enter the sentence number you want (0-{len(sentences)-1}):")
choice = int(input())
elif text_choice == 2:
print(f"Enter the paragraph number you want (0-{len(data)-1}):")
choice = int(input())
elif text_choice == 3:
choice = 0
else:
print("Invalid text selection")
return
Constant Indent error
It looks like you need to indent 107 and 108 one more time
Can you send the full code? If itβs too long for discord, you can use the pastebin https://paste.pythondiscord.com
I suspect you just over indented the if at the top. Anyway, everything at that level needs the same indent, whatever indent you use.
i.e. all the if/elif/else need to line up, and they need the same indent as the words = etc which follow.
@kind harbor ^^
you got it
Click here to see this code in our pastebin.
got it Ill match them up and tell you if anything comes up
Please press the β to upload your file to the pastebin, otherwise I canβt view it on my phone :)
should be accessible
You are having issues at 104 since the if has an extra space or two of indentation compared to the rest of the code
That applies to all the code below 104
If you are using an editor, you should be able to fix it by selecting it all and pressing shift + tab
104-134
yeah it did thatnks a bunch I was stuck on that for way too long
π since python is indentation based, you have to be careful, especially when pasting code. If all is good, !close to close this post
!close
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.