#๐ Help me
47 messages ยท Page 1 of 1 (latest)
@outer oak
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.
come on elaborate problem statement
My msg got deleted
I was making Jarvis and idk why my Jarvis is acting strange whenever I don't give any command to it it automatically opens the video of a creepy nun in YouTube and the fact that I have commented the function to open the YouTube page
then you should give that code also!
!paste is how you share code
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.
You need to share the link
!pypi pyttsx3
Idk about a creepy nun, but this:
elif "youtube" or "play" or "open" in query:
Will not work as you expect.
!pypi pywhatkit
That will always be true. You need a separate in query for each option.
!pypi wikipedia
That one seems unlikely to work.
The commented out code is probably being run, which means there's another copy they're executing
It's working
With how you have it? It does not.
If I say play Weekend or YouTube weekend it opens the video
Dude I have the YouTube function commented
How's that working
Perhaps you're not running what you think you're running.
If you say anything that wasn't caught in the previous ifs it will open a video. elif "youtube" or "play" or "open" in query: will stop executing at elif "youtube", and will always be true. That condition is effectively elif True:.
What could be the solution?
So this is the reason for this creepy nun ?
I have no idea. I'm just pointing out that this is an extraodinarily common mistake
!or
When checking if something is equal to one thing or another, you might think that this is possible:
# Incorrect...
if favorite_fruit == 'grapefruit' or 'lemon':
print("That's a weird favorite fruit to have.")
While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.
So, if you want to check if something is equal to one thing or another, there are two common ways:
# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
print("That's a weird favorite fruit to have.")
# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
print("That's a weird favorite fruit to have.")
basically your condition is same as if you would just write elif "youtube":, which uhh, is always True, and therefore that elif always works
you must put full conditions in-between or operators in your code: if "this" in something or "that" in something:
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.