0
Comparing numbers with boolean true false
in the code print( 1 == 1 < 2) why is the result coming out to be true & not an error. If according to precedence == operator is performed first then print(true<2) should give an error.
2 ответов
+ 1
no here 1==1 will return 1 which is mainly value for true and after that 1<2 will true
0
@@Tarandeep singh
in python....by default 0=False and 1=True
print(True==1)....outputs True
print(True==0)....outputs False
print(True==(any other number))....outputs False
print(1==1<2)
--> print(True<2)
--> print(1<2)......outputs True