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