Informatics Practices
Evaluate the following expressions manually:
(a) (2 + 3) ** 3 - 6/2
(b) (2 + 3) * 5//4 + (4 + 6)/2
(c) 12 + (3 * 4 - 6)/3
(d) 12 + (3 ** 4 - 6)//2
(e) 12 * 3 % 5 + 2 * 6//4
(f) 12 % 5 * 3 + (2 * 6)//4
Answer
(a) (2 + 3) ** 3 - 6/2
= 5**3 - 6/2
= 125 - 6/2
= 125 - 3.0
= 122.0
(b) (2 + 3) * 5//4 + (4 + 6)/2
= 5 * 5//4 + 10/2
= 25 // 4 + 10/2
= 6 + 10/2
= 6 + 5.0
= 11.0
(c) 12 + (3 * 4 - 6)/3
= 12 + (12 - 6)/3
= 12 + 6/3
= 12 + 2.0
= 14.0
(d) 12 + (3 ** 4 - 6)//2
= 12 + (81 - 6)//2
= 12 + 75//2
= 12 + 37
= 49
(e) 12 * 3 % 5 + 2 * 6//4
= 36 % 5 + 2 * 6//4
= 1 + 2 * 6//4
= 1 + 12 // 4
= 1 + 3
= 4
(f) 12 % 5 * 3 + (2 * 6)//4
= 2 * 3 + (2 * 6)//4
= 6 + 12 // 4
= 6 + 3
= 9
Related Questions
Write a Python command/instruction/statement to display your name.
Write a Python command to display your school name, class and section, separated by "-".
Evaluate the above expressions by using IDLE as a calculator and verify the results that you get manually.
Name three run-time errors that occur during Python program execution.