Computer Science, asked by mamtameena2872, 11 hours ago

explain output in python 5<5 or 10 , 5<10or 5 , 5<(5 or 10 ), 5<(10or 5 )

Answers

Answered by PR4N4V
0

Explanation:

In the first one 5 < 5 or 10 when we put it in a print function it will return 10 because it will first check if 5 < 5 it is false so it will check if 5 < 10 it is true so it will print which is greater. In second one it is as same as the first.

In the second and third when in print function it will return as false because it will check if 5 is smaller in every case in bracket do python will know that 10 or 5 can't be greater than 5 but if the command is-

5 < (10 or 15)

it will return true because in both cases 10 and 15 both are greater than 5

ie. 5 < (5 or 10) is same as 5 < 5 and 10

Similar questions