Q. What will be the output of the following Python code?

Code:
l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))
  • (A) [1, 0, 2, ‘hello’, ”, []]
  • (B) Error
  • (C) [1, 2, ‘hello’]
  • (D) [1, 0, 2, 0, ‘hello’, ”, []]
πŸ’¬ Discuss
βœ… Correct Answer: (C) [1, 2, ‘hello’]

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
308
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Neha Sharma
Publisher
πŸ“ˆ
82%
Success Rate