#๐ If
17 messages ยท Page 1 of 1 (latest)
@lethal zealot
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.
do you have some example code you aren't sure about that we could use to discuss this?
like i can explain what i mean
sure
like my question is what does my IF statement cover
I have this code
skibidi = input("tell me your name:")
print("thanks " + skibidi)
if skibidi == "joe" or "Joe" or "jOe" or "joE" or "JOe" or "JoE" or "jOE" or "JOE":
print("JOE MAMA!!")
#improved code if u want joe to not be case sensitive, btw u can copy the whole message # means comment
Hey @lethal zealot!
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.
print("thanks " + skibidi)
if skibidi == "joe" or "Joe" or "jOe" or "joE" or "JOe" or "JoE" or "jOE" or "JOE":
print("JOE MAMA!!")
#improved code if u want joe to not be case sensitive, btw u can copy the whole message # means comment```
Thats my code and my question isif i want some print statements
which print statements will only be sent if my if statement is true, and whicch would go any time
!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.")
!if
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.