#π Random purple 'def'
29 messages Β· Page 1 of 1 (latest)
@slender sail
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.
linting doesn't work well when there's a bug in your code
more specifically, if (index < len(frontier) is missing a closing bracket
OH YEAH I NOTICED
Yeah, thanks, I noticed
I thought it's some IDE issue, it was my code
Thanks!
also the outer () is optional in python, so if index < len(frontier) also suffices
Yeah, I'm just so used to writing that in C
So it kinda moved over to Python
You're not alone - a lot of people do similar things.
Another common trap is trying to do C-style loops in Python so look out for that.
What is C-style loop?
for (int i = 0; i < 5; ++i) {
looping with indices instead of looping directly with values
e.g.
for i in range(len(stuff)): # C style
value = stuff[i]
...
for value in stuff: # Pythonic
...
for i, value in enumerate(stuff): # if you also need the index
...
Thanks for the warning
!close, or just leave it as it'll automatically close after 1 hr of activity
and if anyone has more stuff to add they can
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.