Computer Science, asked by ItzillusionOp, 11 hours ago

Write the output of the following program :
a=50
b=100
print(a<100 and b>50)
print(not(a<100))

Answers

Answered by ziankabir
0

Answer:

Order of Execution of print function is not from left to right , as often misunderstood. It depends upon the arguments , sub-expression and the compiler.

In this particular case , there are two logical operators in the argument of the print function. These are “AND” & “OR”. “AND” operation has higher precedence than “OR” operation, so it is evaluated first.

Hence, print function is evaluated in the following order:

print(a>45 or b>50 and c>10) #and operation is executed first

print(a>45 or (0)) #Since b is not greater than 50 and c is not greater than 0

print(1 or 0) # Since a is 50 and is greater than 45

print(1)

Explanation:

Similar questions