ProgrammingHardGATE CS · Product-company placement

What is printed?

What is printed?
print(int("٤٢"), "²".isdigit(), "²".isdecimal(), "½".isnumeric(), "4.2".isdigit())
  1. A. ValueError True True True False
  2. B. 42 False False True False
  3. C. 42 True False True False
  4. D. 42 True False False True

Correct answer: C. 42 True False True False

int() accepts any Unicode decimal digits, so Arabic-Indic digits parse as 42. Superscript 2 is a digit but not a decimal; ½ is numeric only; '4.2' contains a dot, so isdigit() is False.

More Python Programming questions

Exams that ask this topic