Level 9 : What will be the output of the following Python code?


l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))

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