ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(int(float('1e3')), int('12'))- A. 1000 Error
- B. 1e3 12
- C. 1000 ValueError
- D. 1000 12
Correct answer: D. 1000 12
float('1e3') is 1000.0 and int of that is 1000. int() accepts any Unicode decimal digits, so the full-width digits U+FF11 and U+FF12 read as 12.
More Python Programming questions
- What is printed? python print('%5.2f|%-4d|%04x' % (3.14159, 7, 255))
- What is printed? python a = {1, 2, 3, 4} b = {3, 4, 5} print(a ^ b, a - b, b <= a, a | b == {1, 2, 3, 4, 5})
- What is printed? python print(int(2.675 100), round(2.675, 2))
- What is printed? python print(-7.5 // 2, -7.5 % 2)
- What is printed? python print(pow(3, 0, 1), pow(3, 0), 0 0)
- What is printed? python x = [1, 2, 3, 4, 5] print(x[-1:-4:-1], x[::-1][:2], x[::2][-1])