#๐ function is not returing a variable. when it meant to do that.
49 messages ยท Page 1 of 1 (latest)
@vague gate
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.
im posting the screenshot for context in case if something is wrong with indents which i dont understand how work
can you paste the code instead, my sight is really crap
def another_letter(chosen_word):
letter_counts = Counter(chosen_word)
predicted_letters = []
for letter, count in letter_counts.items():
if count > 1:
predicted_letters.extend([letter] * (count - 1))
return predicted_letters
Hey @vague gate!
It looks like you're trying to paste code into this channel.
Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.
To do this, use the following method:
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
You can **edit your original message** to correct your code block.
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
def another_letter(chosen_word):
letter_counts = Counter(chosen_word)
predicted_letters = []
for letter, count in letter_counts.items():
if count > 1:
predicted_letters.extend([letter] * (count - 1))
return predicted_letters
i cant use predicted_letters outside the function
When do you use/call that function?
looks like you're not calling that function at all
If you don't call a function the code inside will never run
i have another function that i dont call and it works properly
that's doubtful
Looks like you called the choose_word function
also you really shouldnt define functions within an if block
unless you really know what you're doing
Do you understand what a function is?
No worries
Also you aren't stupid, just new, right?
You learned how to make codeblocks in Discord faster than most people
Also you can close this with !close
nah im using python first time since 8 months. and then i used it maybe 2 times
so
yeah]
im new
not to programming
but language
and im pretty tired
Python can be confusing sometimes
its 1 am in my country
yea
bro seriously
more like actually read the bot msg lol
so many ppl just ignore any bot msgs
True
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.