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