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