ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print(int('٣٣') * 2, '٣٣'.isdigit(), '٣٣'.isascii(), '3' == '٣')- A. 66 True True False
- B. 33 True False False
- C. 66 True False False
- D. 66 False False False
Correct answer: C. 66 True False False
int() reads Arabic-Indic digits as their values, so 33 times 2 is 66. isdigit is True, isascii is False, and the two strings are different characters.
More Python Programming questions
- What is printed? python import math print(math.gcd(0, -5), math.gcd(-4, -6), math.lcm(0, 5), math.lcm(-4, 6))
- What is printed? python print(len('%.3f' % 260), '%.3f' % 260, '%.0f' % 1e20)
- What is printed? python print(round(1e16 + 2), round(9.5), round(10.5), round(-9.5))
- What is printed? python print(type(1 / 2).name, type(1 // 2).name, type(2 -1).name, type(2 0.5).name, type(True + 1).name)
- What is printed? python print(sorted(['10', '9', '1.5']), sorted(['10', '9', '1.5'], key=float))
- What is printed? python print(max('the', 'a', key=len), min(['b', 'B'], key=str.lower), ''.join(sorted('cab')), 'cab'.upper().swapcase())