ProgrammingHardTCS NQT · Wipro pattern
What is printed?
What is printed?
print(10 ** 3 == 1000.0, 1e3 == 10 ** 3, type(10 ** 3).__name__, type(1e3).__name__)
- A. True False int float
- B. True True float float
- C. True True int float
- D. False True int float
Correct answer: C. True True int float
10 ** 3 is an int and 1e3 is a float, and the two are equal in value. The type names show the difference between the two results.
More Python Programming questions
- What is printed? python print(bin(5), oct(8), hex(16), int('101', 2) + int('7', 8))
- What is printed? python print(sorted(['apple', 'Banana', 'cherry'], key=str.lower), sorted(['apple', 'Banana', 'cherry']))
- What is printed? python print(sum(range(5)) / len(range(5)), sum([1, 2, 3, 4]) // 4, 9 // 2 2 + 9 % 2)
- What is printed? python print(str(3) + str(4) == '34', 3 + 4 == 7, '3' + '4' == 7)
- What is printed? python print(len(''), len(' '), len('t'), ''.isspace())
- What is printed? python print(1 + '1' if False else '1' + str(1), '3' 2 + str(4 - 1), int('3' 2) + 4 - 1)