ProgrammingModerateTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(len('') or 'empty', [] or 'none')
  1. A. 0 none
  2. B. empty []
  3. C. 0 []
  4. D. empty none

Correct answer: D. empty none

len('') is 0, which is falsy, so or returns 'empty'. The empty list is also falsy, so the second value is 'none'.

More Python Programming questions

Exams that ask this topic