Question discussion

What is the output of the following Python code?print(10 // 3, 10 % 3, 2 ** 3 ** 2)

1587Medium DSSSB TGT Computer Science 0 replies 1 views
0

What is the output of the following Python code?

print(10 // 3, 10 % 3, 2 ** 3 ** 2)
  • A3 1 512
  • B3 1 64
  • C3 1 12
  • D3 3 512
Correct answer: A

Explanation

// gives 3, % gives 1, and ** is right-associative, so 2 ** (3 ** 2) = 2 ** 9 = 512.

Discussion 0

Nobody has replied yet. Start the discussion!