Parentheses & Mixed Logic

Hello CC Forum,

I am working through the Python Course. I have stumbled across something that I am curious about. In a coding language that I am most familiar with, parentheses may be used a bit different. Please find the examples below:

My Code:

def in_range(num, lower, upper):
  if (num >= lower) and (num <= upper):
    return True
  else: 
    return False

CC Code:

def in_range(num, lower, upper):
  if(num >= lower and num <= upper):
    return True
  return False

My question is this: How much do parentheses matter in terms of “mixed logic” - for example: Is this ((a >= b) and (c <= d) and (e != f)) the same as (a >= b and c <= d and e != f)?

Thank you in advanced, and apologies if this has been covered on the forums before.

Yes, those are the same in this case.

But there are cases where the parenthesis are more important.
Here’s one such example with boolean variables a, b, c :

a or (b and c)

is different than

(a or b) and c

Thanks, I think that solves this question. I was just making sure that I wouldn’t have to be worried if I grouped logic up with parenthesis. I’m presuming it’s more of a “redundant code” kind of thing on the Python side.

I am used to coding similar to this:
IF (((A >= B) AND (C != D)) OR (E < F)) as example.

Appreciate the response.