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