ProgrammingModerateTCS NQT · Wipro pattern
What is printed?
What is printed?
print(int('0009'), float('009.50'), int(' -0 '), str(-0))- A. 9 9.5 0 0
- B. 9 9.50 0 0
- C. 9 9.5 1 0
- D. 9 9.5 0 -1
Correct answer: A. 9 9.5 0 0
Leading zeros are allowed in int() and float() decimal literals, and int(' -0 ') is 0. str(-0) is just '0' because integers have no negative zero.
More Python Programming questions
- What is printed? python print(len(str(2 64)), str(2 64)[:4], 2 64 % 1000)
- What is printed? python print('%c%c' % (72, 105), chr(0x263A) == 'u263a', ord('A') + 1, chr(ord('a') + 25))
- What is printed? python print(sum(i i for i in range(10)), sum(range(10)) 2 == sum(i 3 for i in range(10)), sum(range(10)) 2)
- What is printed? python print(f'{3.14159:.2}', f'{"abc":.2}', f'{0.5:.0%}')
- What is printed? python from fractions import Fraction print(Fraction(1, 2) + 0.5 == 1, Fraction(1, 3) 3 == 1, type(Fraction(1, 2) +…
- What is printed? python print(max(-3, 2, key=abs), min(-3, 2, key=abs), sorted([-3, 2, -2], key=abs), sorted([-3, 2, -2], key=lambda v…