ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print(int(' 0x1f ', 16), int('1e3', 16), float('1e3'))- A. 31 483 1000
- B. 31 483 1000.0
- C. 30 483 1000.0
- D. 31 484 1000.0
Correct answer: B. 31 483 1000.0
int accepts surrounding whitespace and the 0x prefix when the base is 16. 1e3 in base 16 is 0x1e3, which is 483, and float('1e3') is 1000.0.
More Python Programming questions
- What is printed? python from collections import Counter c = Counter(['x', 'y', 'x', 'z', 'y', 'x']) print(c.mostcommon()…
- What is printed? python print(10 % 3 2, 10 % (3 2), (10 % 3) 2, -10 % 3 2)
- What is printed? python print(list(range(10, 0, -3)), list(range(-1, -10, -4)), len(range(0, 10, 3)), range(5)[-1])
- What is printed? python print(len('anb'), len('anb'), len(r'anb'), len('arb'))
- What is printed? python print(8 % -3, -8 % -3, 8 // -3, -8 // -3)
- What is printed? python t = str.maketrans('abc', 'xyz') print('aabbcc'.translate(t), len(t))