ProgrammingVery hardJEE Main · CAT placement
What is printed?
What is printed?
print(pow(3, -1, 8))
try:
print(pow(4, -1, 8))
except ValueError:
print('not invertible')- A. 3 not invertible
- B. 3 4
- C. 5 not invertible
- D. 3 0
Correct answer: A. 3 not invertible
3 is its own inverse mod 8 because 3 * 3 = 9 is 1 mod 8. 4 shares a factor with 8, so pow(4, -1, 8) raises ValueError: base is not invertible for the given modulus.
More Python Programming questions
- What is printed? python import math print(math.comb(100, 50) % 1000, 2100 % 9, sum(map(int, str(2100))) % 9)
- What is printed? python print(5e-324 / 2 == 0, 2e-323 > 5e-324, float('1e-400'), 5e-324 / 2 == 0.0)
- What is printed? python import math print(int(-0.5), int(-1.9), math.floor(-1.1), round(-1.5))
- What is printed? python print(7 & -8, 7 | -8, 7 ^ -8, ~7 & 0xFF)
- What is printed? python print(float(' 1000.5 '), float('infinity') > 1e308, float('-nan') != float('-nan'), int(' +0012 '))
- What is printed? python print(b'abc'[0], bytes([65, 66]), bytes.fromhex('41 42'), len(b'a' 2 + b'x00'))