ProgrammingModerateCodeforces-style · placement coding round
What is printed?
What is printed?
print(int('0012'), int('ff', 16), int('0b11', 0), int('12_34'))- A. 12 255 3 12
- B. 0 255 3 1234
- C. 12 255 0 1234
- D. 12 255 3 1234
Correct answer: D. 12 255 3 1234
int with base 0 reads the 0b prefix, and underscores are allowed between digits from Python 3.6. Leading zeros are ignored in base 10.
More Python Programming questions
- What is printed? python print(-7 // 2, -7 % 2, 7 // -2, 7 % -2, divmod(-7, 2))
- What is printed? python print(round(0.5), round(1.5), round(2.5), round(-0.5), round(2.675, 2))
- What is printed? python s = 'aaaa' print(s.count('aa'), s.replace('aa', 'b'), 'a,,b'.split(','), ' x y '.split(' '))
- What is printed? python import itertools print([''.join(p) for p in itertools.permutations('abc', 2)][:4])
- What is printed? python import itertools print(len(list(itertools.combinationswithreplacement(range(5), 3))))
- What is printed? python import itertools print(sum(1 for t in itertools.product('01', repeat=10) if t.count('1') == 3))