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