Level 9 : What will be the output of the following code snippet?


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

Author: SandhyaR | Tags: filter-function | 1859+ Python FAQs | Share
print | using-os-and-pathlib-modules | multiprocessing | numpy | list-method | random-function | name-mangling | python_version | list-methods-and-slicing | compute | dictionary-methods | descriptors | design-principle | multiple-except-blocks | type-conversion | min-max-function | datetime.date,-datetime.time,-datetime.datetime | complex | working-with-temporary-files-using-tempfile | context-manager | advanced-file-operations | with-statement | boolean-masking | data-structure | collection | creating-custom-modules | destructor | namedtuple | logical-operator | condition | aggregating-data-with-functools.reduce() | class-and-object | while-and-for-loop | default-arguments | defining-functions | built-in-function | python-operators | comparison | match | binary-operation | matplotlib | variable | asyncio | syntax-error | append | mysql | data-types | center | comprehension | datetime | string-formatting | counter | dicts | using-else-and-finally | split | mapping-function | mathematical-function | list-operation | mathematics | max-min | data-type | raise | sets | loop-control | keyword | global | async | functional-programming | memory-management | using-yield-in-functions | using-map()-for-transformations | directory-operations | python-django | version | arbitrary-arguments-(*args,-**kwargs) | bitwise-operator | encapsulation | assignment-operator | counter-function | list-slicing | python-history | else-statement | global-variable | built-in-modules | handling-missing-values-(fillna,-dropna) | nested-loop | error-handling | pseudocode | array | matrix-list-comprehension | python | method-overloading | managing-directories-with-os-and-shutil | sorting-and-ranking | oop | file | method | multithreading | parsing-with-strptime | format | rollback | debugging | creating-and-starting-threads | enumerate() | tuple-methods | overriding-methods | functional-programming | int | class | raise-statement | iterable | multiple-inheritance | reading-and-writing-files | oops | for | literal-characters-and-special-characters | postfix | feature | string-method | benefit | docstring | data-structures-in-python | logical-operation | error | regular-expression | conditional-statement | else | map-function | init | decorator | conditional-statements | pickling--unpickling | data-type | conversion | return-statement | walking-through-directories-using-os.walk() | sorting | anchors-(^,-$) | list-indexing | multiple-inheritance | using-lists-as-stacks | global-variable | quantifiers-(*,-+,-?,-{}) | frozenset | implementation | asyncio-module | string-iteration | iterators | scientific-notation | lambda-function | working-with-dates-and-times | thread | range | sum-function | statement | access-modifier | pass | boolean-and-non-boolean | introduction-to-multiprocessing | choice | control-statement | object-attribute | file-handling | identity-operators-(is,-is-not) | single-inheritance | identity-operator | higher-order-function | built-in-function | def | __future__ | package-management | __init_subclass__ | constructor | joining-and-merging-dataframes | introduction-to-threads | reading:-read(),-readline(),-readlines() | opening-files-(open()) | difference-between-threads-and-processes | filter-function | syntaxerror | math | tuple | exception | indexing | update | membership-operators-(in,-not-in) | while-else-loop | min-function | list-comprehension | key-value-pairs | function-argument | indexing:-loc-vs-iloc | dictionary-comprehensions | yield | datatype | set | stack | expression | input-function | dictionaries | unit-testing | threading | syntax-error | formal-and-actual-parameter | odd-number | string-concatenation | floats | magic-method | static-method | set-operation | operator-and | writing:-write(),-writelines() | data-structures | basic | generators | class-decorators | binary | list-comprehension | copy | invalid-list | namespace | thread-synchronization | memory | list-vs-tuple | booleans | mutable | slice | boolean | working-with-file-paths | integer | slicing | type-conversion | global-keyword | error-handling | attribute | dictionary | control-flow | zip | input | operator | lists | inherit | type_conversion | operator-or | immutability | version-check | bitwise | control-flow | arithmetic-expression | __all__-attribute | string-slicing | round-function | type-conversion-and-casting | python-repl | operand | thread-safe-data-structures-(queue.queue) | operations | filtering-and-indexing | test-discovery | call | data-type-conversions | using-assertions-(assertequal,-assertraises) | file-handling | python-syntax-and-structure | tuple-unpacking | module | using-join()-and-is_alive()-methods | immutable-data-type | function | math-copysign | random | print-statement | escape-operator | command-line-parsing | application | join | round | lambda-functions | string-methods | integers | loops | arithmetic-operation | head-and-tail | class-and-instance-variable | touples | built-in | expand-tab | sys-module | recursion | data-structure | comment | complex-number | list,-set,-and-dictionary-comprehensions | functions | string-method | inheritance | logical-operator | exponentiation | lambda | while-loops | sum() | zip-function | pep | staticmethod | generators-in-python | regular-expressions | interpreter | default-mutable-argument | list-mutation | collections | regex | deep-copy | objects | classes | gil | string-slicing | data_structure | decimal | precedence | virtual-environment | introduction-to-python | lambdas | reading-and-writing-large-files-efficiently | virtual-environment | encoding | strings | python-module | bitwise-operator | polymorphism | file_handling | software-design | installation | assignment-operators | list-join | id-function | assert | exception-handling | dataframe-and-series-objects | methods | class-and-inheritance | overflow | syntax | intering | swapping | typeerror | time-series-with-pandas | zfill-function | import-method | string | library | identity-operator | iterator | shallow-copy | sys | pandas | while-loop | recurssion | heap-memory | sorted | logical-operators | loop | formatting-with-strftime | input-function | exception-handling | loop-control-statements | turtle | list-comprehensions | string-manipulation | operators | operator-overloading | list | goto-function | fabs-function | identifier | generator | string-formatting | numeric | indentation | parameter | floating-point-precision | precedence-and-associativity | function-and-scope | factorial-function | using-the-threading-module | why-use-multiprocessing-over-threading?-(gil) | working-with-binary-files-(rb,-wb) | tuples | filter | matrix | conditional-statement ...