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