ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(1_000_000 == 10 ** 6, 0x_1F, 1e3 == 1000)
- A. False 31 True
- B. True 31 True
- C. True 1F True
- D. True 31 False
Correct answer: B. True 31 True
Underscores are allowed between digits, and after a base prefix. 0x_1F is 31 and 1e3 is the float 1000.0, which equals 1000.
More Python Programming questions
- What is printed? python print(oct(64), hex(-255), bin(0))
- What is printed? python print(ord('A') ^ 32, chr(ord('a') - 32))
- What is printed? python t = ([],) t[0].append(1) print(t, t[0] is t[0])
- What is printed? python print(list(dict.fromkeys('mississippi')))
- What is printed? python print(any([]) or all([]) and 'x')
- What is printed? python s = 'hello' print(s[1:-1][::-1], s[-1:0:-2])