#🔒 parenthesis doubt!

42 messages · Page 1 of 1 (latest)

tender cargo
#

"if (r_int == 1 and u_res == 1) or (r_int == 2 and u_res ==2) or (r_int == 3 and u_res == 3):"
in this line of code, does parenthesis make three 3 blocks and code would execute like "if code_1 or code_2 or code_3?"

timber saddleBOT
#

@tender cargo

Python help channel opened

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.

tender cargo
#

Mention me while replying please

#

Thankyou!

tender cargo
#

okokk

#

thank you!

safe compass
#

but the parentheses do nothing here

#

because and is already executed before or without parentheses

tender cargo
#

so if i remove parenthesis

#

execution would be like...?

safe compass
#

it wouldn't change anything in this case

tender cargo
#

so it will consider 1st and

#

then go to next statement next to or and so on?

#

like 1_result or 2_result or 3_result

#

then will compare the three?

safe compass
#

it's a bit different because and and or are both short-circuit operations

#

if both r_int == 1 and u_res == 1 are True then nothing else will be checked.

tender cargo
#

also how are you making "and" and "or" look different?😅

#

like code stuff

#

with bg

#

ouuu

safe compass
#

you can put short code into backticks like `code` so it becomes code

tender cargo
#

wait

#

like this

#

damnn

safe compass
#

exactly

#

and longer code can be put between three backticks. you can also specify the language then to enable formatting.
```py
if True:
print("it's true")
```
becomes

if True:
    print("it's true")
tender cargo
#

damnnnnn

#

sexyyy

#

it will be of great help in future

#

but this can be used only in this server right?

tender cargo
#

lesss gooo

#

Arigatoooo!!

#

I am from India BTW

#

then also

#

Arigaatoo

timber saddleBOT
#
Python help channel closed for inactivity

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.