Level 1 : What will be the output of the following code ?


a = [[], "abc", [0], 1, 0]
print(list(filter(bool, a)))

Author: KaivalyaG | Tags: filter | 1736+ Python FAQs | Share
identity-operator | virtual-environment | feature | id-function | logical-operator | objects | matplotlib | integer | docstring | global-keyword | logical-operator | data-type | loop | heap-memory | data-structure | mutable | binary-operation | type-conversion | deep-copy | data_structure | design-principle | string-concatenation | name-mangling | lists | dictionaries | generators-in-python | class-and-inheritance | datetime | fabs-function | classes | compute | software-design | namespace | list-comprehension | syntaxerror | python-django | datatype | python-history | async | exception | type_conversion | list-vs-tuple | list-operation | string-manipulation | statement | indentation | regular-expression | numeric | assert | conversion | sum-function | default-mutable-argument | magic-method | lambda-function | bitwise-operator | precedence | pseudocode | input-function | for | bitwise-operator | pickling-&-unpickling | max-min | debugging | loop-control | logical-operation | method | context-manager | zip | invalid-list | expand-tab | filter | expression | list-comprehension | keyword | methods | int | __all__-attribute | library | condition | __init_subclass__ | call | sorted | list | string-method | frozenset | version | comparison | collection | oop | formal-and-actual-parameter | while-and-for-loop | package-management | python_version | string-iteration | function-and-scope | collections | counter-function | operator-or | staticmethod | destructor | functional-programming | global-variable | init | string-formatting | oops | min-max-function | variable | pandas | class | raise | while-else-loop | round | lambda | enumerate() | overflow | descriptors | floating-point-precision | assignment-operator | polymorphism | error-handling | arithmetic-operation | while-loop | virtual-environment | precedence-and-associativity | def | mysql | version-check | lambdas | nested-loop | file | file_handling | type-conversion | operand | mathematical-function | built-in-function | complex-number | indexing | encoding | constructor | application | implementation | mapping-function | generator | string-method | input-function | sys | split | slicing | file-handling | recurssion | identity-operator | sorting | choice | function-argument | recursion | join | return-statement | file-handling | conditional-statement | immutability | exponentiation | zip-function | syntax-error | command-line-parsing | import-method | tuple | basic | factorial-function | memory-management | error | swapping | yield | class-and-object | shallow-copy | center | parameter | control-flow | decorator | comprehension | round-function | min-function | random-function | string-slicing | syntax-error | bitwise | pep | dictionary | turtle | map-function | print-statement | regex | asyncio | matrix | sum() | boolean-and-non-boolean | threading | string-slicing | identifier | list-method | sys-module | scientific-notation | data-type | head-and-tail | else-statement | filter-function | built-in-function | tuple-unpacking | update | asyncio-module | operator-overloading | with-statement | random | append | escape-operator | print | math-copysign | python | global | iterable | format | typeerror | zfill-function | list-mutation | loops | syntax | list-indexing | exception-handling | odd-number | built-in | object-attribute | set-operation | function | comment | installation | multiple-inheritance | goto-function | control-statement | conditional-statement | higher-order-function | input | encapsulation | match | immutable-data-type | inheritance | generators | python-repl | module | slice | class-and-instance-variable | operations | global-variable | memory | postfix | boolean | python-module | access-modifier | thread | touples | data-structures | math | operators | operator | operator-and | attribute | functions | set | decimal | range | multithreading | counter | exception-handling | multiprocessing | namedtuple | gil | static-method | dicts | stack | complex | control-flow | numpy | array | binary | iterator | arithmetic-expression | copy | inherit | string | mathematics | benefit | interpreter | __future__ | list-slicing | list-join | string-formatting | matrix-list-comprehension | data-structure | rollback ...