The reason why 3>2>1 returns True whereas (3>2)>1 returns False in Python is because of the way that the comparison operators work in Python.
In the first example, 3>2>1, Python is interpreting this as (3>2) and (2>1). The first comparison 3>2 returns True, which is then compared to 2>1 which also returns True. Since both comparisons are True, the overall expression evaluates to True.
In the second example, (3>2)>1, Python is interpreting this as True>1. The comparison True>1 returns False as true is considered 1 and 1 is not greater than 1.
In Python, comparison operators return a Boolean value, True or False, rather than an integer value. When a Boolean value is used in a numeric context, such as a comparison, True is interpreted as 1 and False is interpreted as 0 , that's why the second example return False.