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