Computer Science, asked by arushisri3108, 4 months ago

Evaluate the following expressions:

a) 6 * 3 + 4**2 // 5 – 8

b) 10 > 5 and 7 > 12 or not 18 > 3

2

Answers

Answered by miltanm
31

Answer:

Evaluate the following expressions:

10 > 5 and 7 > 12 or not 18 > 3

Explanation:

10>5 = True

7>12 = False

18>13  = True

Now, T AND F or NOT True

T AND F = F, NOT True= F

Then, F or F=F

MILTAN PRABHAKARAN M , PEM SCHOOL OF EXCELLENCE....

ANY DOUBTS JUST CALL ME :919486283004

Answered by kartavyaguptasl
1

Answer:

The correct answers for the given expressions is found to be as follows:

(a) 13

(b) False

Explanation:

For (a) part:

We are given the expression:

6*3+4**2//5-8

We will solve this by the order of precedence of operators in python, which is as follows:

Exponentiation (**) followed by Complement (~), then Multiplication (*)/Division (/)/Floor Division (//)/Modulus (%) and lastly Addition (+)/Subtraction (-) followed by Bitwise, Comparison and logical operators.

Following this and simplifying, we get:

(6*3)+((4**2)//5)-8

(6*3)+(16//5)-8

(18)+(3)-8

21-8\\

or we can say:

\implies 13

Thus, the given expression's simplification gives us the value of 13.

For (b) part:

We are given the expression:

10 > 5\ and\ 7 > 12\ or\ not\ 18 > 3

Now, we know that the operators used are Logical operators and the comparison operators.

Comparison operators have a higher precedence and gives an output of either True or False.

Thus, simplifying the Comparison operators, we get:

(10 > 5)\ and\ (7 > 12)\ or\ (not\ (18 > 3))\\True\ AND\ False\ OR\ (NOT\ True)

Now, resolving the logical operators, we get:

(True\ AND\ False)\ OR\ (NOT\ True)

False\ OR\ False

\implies False

Thus, the given expression bears the value of False.

#SPJ3

Similar questions