ProgrammingModerateTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(10 ** -2, 10 ** 2.0, 10 // 3.0)
- A. 0.01 100.0 3
- B. 0.01 100.0 3.0
- C. 0.01 100 3
- D. 0 100.0 3.0
Correct answer: B. 0.01 100.0 3.0
A negative int exponent gives a float, 0.01. Any float operand makes the result a float, so 10 ** 2.0 is 100.0 and 10 // 3.0 is 3.0.
More Python Programming questions
- What is printed? python print(all([]), any([]), all(x > 0 for x in [1, 0]))
- What is printed? python print(list(map(lambda x, y: x y, [1, 2, 3], [4, 5])))
- What is printed? python print(sum([[1], [2, 3]], []), sum([[1], [2]], [0]) if False else 'skip')
- What is printed? python print(''.join(sorted(set('hello'), key=ord)))
- What is printed? python print(len({0.0, -0.0, 1}), hash(1) == hash(1.0) == hash(True))
- What is printed? python print(1 == 1.0 == True, {1: 'a'}.get(True))